import { DocumentVerificationCard } from './DocumentVerificationCard';
import { useUpdateCandidateEducation } from '@/hooks/backoffice/useUpdateCandidateEducation';
import { CandidateDocumentTypes, DocumentStatuses } from '@heygermany/sdk';

type EducationVerificationCardProps = {
  candidateId: string;
  education: any;
  documents?: any[];
  verbose?: boolean;
};

export function EducationVerificationCard({ candidateId, education, documents = [], verbose = false }: EducationVerificationCardProps) {
  const mutationHook = useUpdateCandidateEducation(candidateId);
  const verificationDocuments = documents
    .map((document, index) => ({
      documentId: document.documentId,
      documentStatus: document.documentStatus ?? DocumentStatuses.UNVERIFIED,
      label: document.fileName || `File ${index + 1}`
    }));

  return (
    <DocumentVerificationCard
      candidateId={candidateId}
      documents={verificationDocuments}
      category={CandidateDocumentTypes.EDUCATION}
      aiExtractedData={{
        institution: education.aiInstitution,
        country: education.aiCountry,
        program: education.aiProgram,
        completionDate: education.aiCompletionDate,
        nursingRelatedDegree: education.aiNursingRelatedDegree,
        accreditedUniversity: education.aiAccreditedUniversity,
        accreditedStudyProgram: education.aiAccreditedStudyProgram,
        isNursingFocus: education.aiIsNursingFocus,
        hasTheory: education.aiHasTheory,
        hasPractice: education.aiHasPractice,
        durationHours: education.aiDurationHours
      }}
      finalData={{
        institution: education.institution,
        country: education.country,
        program: education.program,
        completionDate: education.completionDate,
        nursingRelatedDegree: education.nursingRelatedDegree,
        accreditedUniversity: education.accreditedUniversity,
        accreditedStudyProgram: education.accreditedStudyProgram,
        isNursingFocus: education.isNursingFocus,
        hasTheory: education.hasTheory,
        hasPractice: education.hasPractice,
        durationHours: education.durationHours
      }}
      mutationHook={mutationHook}
      verbose={verbose}
      requiredFields={[
        'institution',
        'country',
        'program',
        'nursingRelatedDegree',
        'accreditedUniversity',
        'accreditedStudyProgram',
        'isNursingFocus',
        'hasTheory',
        'hasPractice',
        'durationHours'
      ]}
    />
  );
}
