export type UserRole = 'admin' | 'owner'

export type UserType = 'company' | 'backoffice' | 'candidate'

export type LanguageLevel =
  | 'NONE'
  | 'A_ONE'
  | 'A_TWO'
  | 'B_ONE'
  | 'B_TWO'
  | 'C_ONE'
  | 'C_TWO'

export type CandidateDocumentType =
  | 'education'
  | 'license'
  | 'language'
  | 'work_experience'
  | 'profile_image'

export type DocumentStatus = 'Missing' | 'Invalid' | 'Verified' | 'Unverified'

export type ApplicantStatus =
  | 'Initial'
  | 'Invalid'
  | 'Pending'
  | 'Complete'
  | 'Failed'

export type NurseRecognitionGermany =
  | 'nurse'
  | 'assistant_nurse'
  | 'nursing_helper'

export type NurseRecognitionHomeCountry =
  | 'nurse'
  | 'assistant_nurse'
  | 'nursing_helper'
  | 'none'

export type RecognitionLikelihood = 'low' | 'medium' | 'high'

export type ProfessionalRecognitionStatus =
  | 'NOT_STARTED'
  | 'IN_PROGRESS'
  | 'COMPLETED'

export type LanguageCode =
  | 'en'
  | 'ar'
  | 'bs'
  | 'fil'
  | 'hi'
  | 'es'
  | 'tr'
  | 'uk'
  | 'vi'

export type GermanState =
  | 'Baden-Württemberg'
  | 'Bayern'
  | 'Berlin'
  | 'Brandenburg'
  | 'Bremen'
  | 'Hamburg'
  | 'Hessen'
  | 'Mecklenburg-Vorpommern'
  | 'Niedersachsen'
  | 'Nordrhein-Westfalen'
  | 'Rheinland-Pfalz'
  | 'Saarland'
  | 'Sachsen'
  | 'Sachsen-Anhalt'
  | 'Schleswig-Holstein'
  | 'Thüringen'

export type RecognitionDossierStatus =
  | 'draft'
  | 'blocked'
  | 'ready'
  | 'generating'
  | 'generated'
  | 'unsupported'
  | 'failed'

export type RecognitionDossierDocumentCategory =
  | 'passport'
  | 'birth_certificate'
  | 'name_change_proof'
  | 'employer_intent'
  | 'medical_certificate'
  | 'police_clearance'
  | 'translation'
  | 'authority_form'
  | 'power_of_attorney'
  | 'waiver_form'
  | 'other'

export interface Candidate {
  candidateId: string
  email: string
  name: string
  stateWorkPreference: GermanState[] | null
  joinTalentPool: boolean | null
  livingInGermany: boolean | null
  euPassport: boolean | null
  countryEducation: string | null
  licenseProvided: boolean | null
  languageCertificateProvided: boolean | null
  languageSelfAssessmentLevel: LanguageLevel | null
  submittedAt: Date | null
  createdAt: Date | null
  lastUpdatedAt: Date | null
  phone: string | null
  dateOfBirth: Date | null
  currentResidence: string | null
  qualificationStatusHomeCountry: NurseRecognitionHomeCountry | null
  qualificationStatusGermany: NurseRecognitionGermany | null
  licenseMandatory: boolean | null
  durationRequirementsMet: boolean | null
  status: ApplicantStatus
  incompleteReminderSentAt: Date | null
  recognitionLikelihood: RecognitionLikelihood | null
  professionalRecognitionStatus: ProfessionalRecognitionStatus | null
  nationality: string | null
  languagesSpoken: LanguageCode[] | null
  statusChangedAt: Date
  lifecycleNotifications: unknown
  analysisLastRunAt: Date | null
  analysisInputFingerprint: string | null
  invalidatedAt: Date | null
  reuploadRequestedAt: Date | null
  reuploadedAt: Date | null
  failedPurgedAt: Date | null
}

export interface CandidateDocument {
  documentId: string
  candidateId: string
  category: CandidateDocumentType
  title: string | null
  note: string | null
  filePath: string
  fileName: string
  fileSize: number | null
  mimeType: string | null
  uploaded: boolean | null
  createdAt: Date | null
  lastUpdatedAt: Date | null
  ocrText: string | null
  ocrModel:
    | 'tesseract'
    | 'azure_cognitive'
    | 'aws_textract'
    | 'google_vision'
    | 'manual_entry'
    | null
  ocrStartedAt: Date | null
  ocrEndedAt: Date | null
  documentStatus: DocumentStatus
}

export interface CandidateEducation {
  educationId: string
  candidateId: string
  institution: string | null
  country: string | null
  program: string | null
  completionDate: Date | null
  aiInstitution: string | null
  aiCountry: string | null
  aiProgram: string | null
  aiCompletionDate: Date | null
  aiExtractedBy:
    | 'gpt-five'
    | 'claude-three-opus'
    | 'claude-three-sonnet'
    | 'claude-three-haiku'
    | 'gemini-pro'
    | null
  aiExtractionDate: Date | null
  createdAt: Date | null
  lastUpdatedAt: Date | null
  nursingRelatedDegree: boolean | null
  accreditedUniversity: boolean | null
  accreditedStudyProgram: boolean | null
  aiNursingRelatedDegree: boolean | null
  aiAccreditedUniversity: boolean | null
  aiAccreditedStudyProgram: boolean | null
  hasTheory: boolean | null
  hasPractice: boolean | null
  durationHours: number | null
  isNursingFocus: boolean | null
  aiHasTheory: boolean | null
  aiHasPractice: boolean | null
  aiDurationHours: number | null
  aiIsNursingFocus: boolean | null
}

export interface CandidateExperience {
  experienceId: string
  candidateId: string
  employerName: string | null
  roleTitle: string | null
  department: string | null
  startDate: Date | null
  endDate: Date | null
  createdAt: Date | null
  lastUpdatedAt: Date | null
  country: string | null
  city: string | null
  facilityType: string | null
}

export interface CandidateLanguage {
  languageId: string
  candidateId: string
  level: LanguageLevel | null
  issuingBody: string | null
  issueDate: Date | null
  certifiedSkills: string | null
  aiLevel: LanguageLevel | null
  aiIssuingBody: string | null
  aiIssueDate: Date | null
  aiCertifiedSkills: string | null
  aiExtractedBy:
    | 'gpt-five'
    | 'claude-three-opus'
    | 'claude-three-sonnet'
    | 'claude-three-haiku'
    | 'gemini-pro'
    | null
  aiExtractionDate: Date | null
  createdAt: Date | null
  lastUpdatedAt: Date | null
}

export interface CandidateLicense {
  licenseId: string
  candidateId: string
  licenseNumber: string | null
  issuingAuthority: string | null
  issueDate: Date | null
  expiryDate: Date | null
  status: string | null
  licenseType: string | null
  aiLicenseNumber: string | null
  aiIssuingAuthority: string | null
  aiIssueDate: Date | null
  aiExpiryDate: Date | null
  aiStatus: string | null
  aiLicenseType: string | null
  aiExtractedBy:
    | 'gpt-five'
    | 'claude-three-opus'
    | 'claude-three-sonnet'
    | 'claude-three-haiku'
    | 'gemini-pro'
    | null
  aiExtractionDate: Date | null
  createdAt: Date | null
  lastUpdatedAt: Date | null
}

export interface RecognitionDossier {
  dossierId: string
  candidateId: string
  targetState: GermanState
  targetProfession: NurseRecognitionGermany
  status: RecognitionDossierStatus
  rulesVersion: string | null
  inputFingerprint: string | null
  generatedAt: Date | null
  packageFilePath: string | null
  submissionGuideJson: unknown
  checklistJson: unknown
  blockingIssuesJson: unknown
  createdAt: Date | null
  lastUpdatedAt: Date | null
}

export interface RecognitionDossierDocument {
  documentId: string
  dossierId: string
  candidateId: string
  category: RecognitionDossierDocumentCategory
  title: string | null
  note: string | null
  filePath: string
  fileName: string
  fileSize: number | null
  mimeType: string | null
  uploaded: boolean | null
  documentStatus: DocumentStatus
  createdAt: Date | null
  lastUpdatedAt: Date | null
}

export declare namespace DB {
  export type Candidate = import('./db.js').Candidate
  export type CandidateDocument = import('./db.js').CandidateDocument
  export type CandidateEducation = import('./db.js').CandidateEducation
  export type CandidateExperience = import('./db.js').CandidateExperience
  export type CandidateLanguage = import('./db.js').CandidateLanguage
  export type CandidateLicense = import('./db.js').CandidateLicense
  export type RecognitionDossier = import('./db.js').RecognitionDossier
  export type RecognitionDossierDocument = import('./db.js').RecognitionDossierDocument
  export type UserRole = import('./db.js').UserRole
  export type UserType = import('./db.js').UserType
  export type LanguageLevel = import('./db.js').LanguageLevel
  export type CandidateDocumentType = import('./db.js').CandidateDocumentType
  export type DocumentStatus = import('./db.js').DocumentStatus
  export type ApplicantStatus = import('./db.js').ApplicantStatus
  export type NurseRecognitionGermany = import('./db.js').NurseRecognitionGermany
  export type NurseRecognitionHomeCountry = import('./db.js').NurseRecognitionHomeCountry
  export type RecognitionLikelihood = import('./db.js').RecognitionLikelihood
  export type ProfessionalRecognitionStatus = import('./db.js').ProfessionalRecognitionStatus
  export type LanguageCode = import('./db.js').LanguageCode
  export type GermanState = import('./db.js').GermanState
  export type RecognitionDossierStatus = import('./db.js').RecognitionDossierStatus
  export type RecognitionDossierDocumentCategory = import('./db.js').RecognitionDossierDocumentCategory
}
