'use client'

import type { CandidateResults } from '@heygermany/sdk'
import { useI18n } from '@/context/i18n-provider'
import { useSearchParams } from '@/framework/navigation'
import { CandidateResult } from './CandidateResult'

function buildDemoCandidateResults(
  t: ReturnType<typeof useI18n>,
  candidateName: string
): CandidateResults {
  const currentGermanLevel = 'B1'

  return {
    education: {
      title: t('jobs.qualifications.education.match.title'),
      description: t('jobs.qualifications.education.match.description'),
      status: 'completed',
      requirements: [
        t('jobs.qualifications.education.match.requirements.degree'),
        t('jobs.qualifications.education.match.requirements.accredited'),
        t('jobs.qualifications.education.match.requirements.structured'),
      ],
    },
    license: {
      title: 'Nursing License',
      description: 'Missing nursing license or registration from your home country.',
      status: 'required',
      requirements: [
        'Nursing license from your home country required for job recognition',
      ],
      steps: ['Obtain your license from your home country'],
    },
    language: {
      title: 'German Proficiency',
      description: 'Demonstrate required German language skills.',
      status: 'in-progress',
      progress: 75,
      requirements: [
        'German level B2',
        'Language certificate (Goethe-Institut, telc, TestDaF, or ECL)',
      ],
      steps: [
        `Improve your German level from ${currentGermanLevel} to B2`,
        'Get a language certificate from Goethe-Institut, telc, TestDaF, or ECL',
      ],
    },
    experience: {
      title: 'Work Experience',
      description: 'Upload your CV to our platform to connect with employers.',
      status: 'optional',
      requirements: [
        'Curriculum Vitae (CV)',
      ],
      steps: [
        'Create your CV',
        'Upload it to your profile',
      ],
    },
    copies: {
      title: 'Copies',
      description: 'Provide notarized or certified copies of required documents.',
      status: 'required',
      requirements: [
        'Passport copy',
        'Education documents copies',
        'Police clearance certificate copy',
        'Certificate of good standing copy',
      ],
      steps: [
        'Prepare document copies',
        'Translate by sworn translator if required',
      ],
    },
    originals: {
      title: 'Originals',
      description: 'Prepare required originals for submission to the authority.',
      status: 'required',
      requirements: [
        'Completed application form',
        'CV (signed and dated)',
        'Medical fitness certificate',
        'Certificate of good conduct',
      ],
      steps: [
        'Prepare originals',
        'Submit to the authority',
      ],
    },
    joinTalentPool: false,
    nextSteps: {
      gethelp: {
        title: 'Get Help',
        subtitle: 'Get free support for your application in Germany. Many services help internationally trained professionals like you succeed in job recognition. Seek help before you start the process — it can make all the difference.',
        costs: 'Cost: Free',
        button: 'Find a counseling service',
      },
      connect: {
        title: 'Connect with Employers',
        subtitle: 'Engaging with a German employer early can boost your chances of success. They can guide you through requirements, provide documents, and support your recognition process from start to finish. We’ll help you connect with your future employer.',
        costs: 'Cost: Free',
        buttonjoin: 'Join our talent pool',
        buttonimprove: 'Improve your profile',
      },
      documents: {
        title: 'Prepare Your Documents',
        subtitle: "Gather all necessary documents you will need for your job recognition application. Some must be in original, others as copies, and in most cases, certified translations are required",
        costs: 'Cost: 200-300€ for translated documents',
        button: 'Check required documents',
      },
      submit: {
        title: 'Submit Your Application',
        subtitle: `To begin the recognition process, you'll need to submit an application for permission to use the professional title "Registered Nurse" (Pflegefachfrau or Pflegefachmann) to the relevant authority (LaGeSo). Make sure you have all required documents before you start the process. Incomplete submissions can slow down your recognition process unnecessarily`,
        costs: 'Cost: 250-350€ for recognition fee',
        button: 'Learn how to apply',
      },
      compensatory: {
        title: 'Complete a Compensatory Measure',
        subtitle: 'After you submit your recognition application, you’ll receive a Deficit Notice from LaGeSo. It shows where your qualification differs from the German nursing standard and outlines the compensatory measures you can take to achieve full recognition. You can choose either an Adaptation Program or a Knowledge Exam.',
        costs: 'Cost: Varies',
        button: 'Explore compensatory measures',
      },
      german: {
        title: 'Improve Your German',
        subtitle: `You're currently at ${currentGermanLevel} — almost there! To gain full recognition and work as a nurse in Berlin, you'll need to improve your German to B2 level. There are several options available to help fund your language courses.`,
        costs: 'Cost: Varies (see tips)',
        button: 'Find courses and funding options',
      },
    },
    textContent: {
      renderPath: 'nurse.missingLicense',
      hero: `Good News ${candidateName}`,
      result: 'You May Qualify as a Nurse in Berlin',
      explanation: [
        'Based on your documents, you already fulfill some of the requirements to work as a <strong>Nurse (Pflegefachkraft)</strong> in Berlin. To move forward, you still need to provide some important documents for your qualification to be recognized in Germany— most importantly, your Nursing <strong>License</strong> or Nursing Registration from your home country.',
        "This means you're already on the right track! Please make sure you have all the required documents for job recognition ready once you start the process. There are many free advisory services available to support you along the way. Please keep in mind that this is an early and independent assessment to support your journey. Final recognition is granted by the official German authorities and includes additional steps. This assessment is not legally binding.",
      ],
      recognition: [
        '🔍 Likely Outcome of Job Recognition: Partial Job Recognition',
        "Your qualification aligns <i>partially</i> with German nursing standards — that's a strong foundation!",
        'To achieve full recognition and be able to work as a nurse you may need to complete a <strong>compensatory measure</strong> and reach <strong>B2</strong> in German.',
        "Please note: Your professional <strong>license</strong> wasn't uploaded yet. It's a required document for recognition, so make sure you have it available when starting your application.",
      ],
      notes: {
        afterExplanation: [
          'Please note that you need a B1 German language certificate in order to obtain a visa for Germany.',
        ],
      },
    },
  }
}

export function DemoCandidateResultPage() {
  const t = useI18n()
  const searchParams = useSearchParams()
  const candidateName = searchParams.get('name') || 'Maria Santos'
  const candidateResults = buildDemoCandidateResults(t, candidateName)

  return (
    <CandidateResult
      candidateResults={candidateResults}
      ctaPublicMode={true}
    />
  )
}
