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

type ExperienceVerificationCardProps = {
  candidateId: string;
  experience: any;
  documents?: any[];
  verbose?: boolean;
};

export function ExperienceVerificationCard({ candidateId, experience, documents = [], verbose = false }: ExperienceVerificationCardProps) {
  const mutationHook = useUpdateCandidateExperience(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.WORK_EXPERIENCE}
      aiExtractedData={{
        employer: experience.aiEmployer,
        position: experience.aiPosition,
        department: experience.aiDepartment,
        startDate: experience.aiStartDate,
        endDate: experience.aiEndDate,
        durationMonths: experience.aiDurationMonths,
        isFullTime: experience.aiIsFullTime,
        duties: experience.aiDuties
      }}
      finalData={{
        employer: experience.employer,
        position: experience.position,
        department: experience.department,
        startDate: experience.startDate,
        endDate: experience.endDate,
        durationMonths: experience.durationMonths,
        isFullTime: experience.isFullTime,
        duties: experience.duties
      }}
      mutationHook={mutationHook}
      verbose={verbose}
      requiredFields={[]} // Work experience: only show header when not verbose
    />
  );
}
