// Generated TypeScript types from Pydantic models
// Source: src/backend/models.py
// Generated on: 2025-06-07T20:43:58.855207
// DO NOT EDIT MANUALLY - This file is auto-generated

// ============================
// Enums
// ============================

export type AIModelType = "qwen2.5" | "flux-schnell";

export type ActivityType = "login" | "search" | "view_job" | "apply_job" | "message" | "update_profile" | "chat";

export type ApiActivityType = "system" | "info" | "searching" | "thinking" | "generating" | "converting" | "generating_image" | "tooling" | "heartbeat";

export type ApiMessageType = "binary" | "text" | "json";

export type ApiStatusType = "streaming" | "status" | "done" | "error";

export type ApplicationStatus = "applied" | "reviewing" | "interview" | "offer" | "rejected" | "accepted" | "withdrawn";

export type ChatContextType = "job_search" | "job_requirements" | "candidate_chat" | "interview_prep" | "resume_review" | "general" | "generate_persona" | "generate_profile" | "generate_image" | "rag_search" | "skill_match";

export type ChatSenderType = "user" | "assistant" | "system" | "information" | "warning" | "error";

export type ColorBlindMode = "protanopia" | "deuteranopia" | "tritanopia" | "none";

export type DataSourceType = "document" | "website" | "api" | "database" | "internal";

export type DocumentType = "pdf" | "docx" | "txt" | "markdown" | "image";

export type EmploymentType = "full-time" | "part-time" | "contract" | "internship" | "freelance";

export type FontSize = "small" | "medium" | "large";

export type InterviewRecommendation = "strong_hire" | "hire" | "no_hire" | "strong_no_hire";

export type InterviewType = "phone" | "video" | "onsite" | "technical" | "behavioral";

export type LanguageProficiency = "basic" | "conversational" | "fluent" | "native";

export type MFAMethod = "app" | "sms" | "email";

export type NotificationType = "email" | "push" | "in_app";

export type ProcessingStepType = "extract" | "transform" | "chunk" | "embed" | "filter" | "summarize";

export type SalaryPeriod = "hour" | "day" | "month" | "year";

export type SearchType = "similarity" | "mmr" | "hybrid" | "keyword";

export type SkillLevel = "beginner" | "intermediate" | "advanced" | "expert";

export type SkillStatus = "pending" | "complete" | "waiting" | "error";

export type SocialPlatform = "linkedin" | "twitter" | "github" | "dribbble" | "behance" | "website" | "other";

export type SortOrder = "asc" | "desc";

export type ThemePreference = "light" | "dark" | "system";

export type UserGender = "female" | "male";

export type UserStatus = "active" | "inactive" | "pending" | "banned";

export type UserType = "candidate" | "employer" | "guest";

export type VectorStoreType = "chroma";

// ============================
// Interfaces
// ============================

export interface AccessibilitySettings {
  fontSize: "small" | "medium" | "large";
  highContrast: boolean;
  reduceMotion: boolean;
  screenReader: boolean;
  colorBlindMode?: "protanopia" | "deuteranopia" | "tritanopia" | "none";
}

export interface Analytics {
  id?: string;
  entityType: "job" | "candidate" | "chat" | "system" | "employer";
  entityId: string;
  metricType: string;
  value: number;
  timestamp: Date;
  dimensions?: Record<string, any>;
  segment?: string;
}

export interface ApiMessage {
  id?: string;
  sessionId: string;
  senderId?: string;
  status: "streaming" | "status" | "done" | "error";
  type: "binary" | "text" | "json";
  timestamp?: Date;
}

export interface ApiResponse {
  success: boolean;
  data?: any;
  error?: ErrorDetail;
  meta?: Record<string, any>;
}

export interface ApplicationDecision {
  status: "accepted" | "rejected";
  reason?: string;
  date: Date;
  by: string;
}

export interface Attachment {
  id?: string;
  fileName: string;
  fileType: string;
  fileSize: number;
  fileUrl: string;
  uploadedAt: Date;
  isProcessed: boolean;
  processingResult?: any;
  thumbnailUrl?: string;
}

export interface AuthResponse {
  accessToken: string;
  refreshToken: string;
  user: any;
  expiresAt: number;
}

export interface Authentication {
  userId: string;
  passwordHash: string;
  salt: string;
  refreshTokens: Array<RefreshToken>;
  resetPasswordToken?: string;
  resetPasswordExpiry?: Date;
  lastPasswordChange: Date;
  mfaEnabled: boolean;
  mfaMethod?: "app" | "sms" | "email";
  mfaSecret?: string;
  loginAttempts: number;
  lockedUntil?: Date;
}

export interface BaseUser {
  id?: string;
  email: string;
  firstName: string;
  lastName: string;
  fullName: string;
  phone?: string;
  location?: Location;
  createdAt: Date;
  updatedAt: Date;
  lastLogin?: Date;
  profileImage?: string;
  status: "active" | "inactive" | "pending" | "banned";
  isAdmin: boolean;
}

export interface BaseUserWithType {
  id?: string;
  email: string;
  firstName: string;
  lastName: string;
  fullName: string;
  phone?: string;
  location?: Location;
  createdAt: Date;
  updatedAt: Date;
  lastLogin?: Date;
  profileImage?: string;
  status: "active" | "inactive" | "pending" | "banned";
  isAdmin: boolean;
  userType: "candidate" | "employer" | "guest";
}

export interface Candidate {
  id?: string;
  email: string;
  firstName: string;
  lastName: string;
  fullName: string;
  phone?: string;
  location?: Location;
  createdAt: Date;
  updatedAt: Date;
  lastLogin?: Date;
  profileImage?: string;
  status: "active" | "inactive" | "pending" | "banned";
  isAdmin: boolean;
  userType: "candidate";
  username: string;
  description?: string;
  resume?: string;
  skills?: Array<Skill>;
  experience?: Array<WorkExperience>;
  questions?: Array<CandidateQuestion>;
  education?: Array<Education>;
  preferredJobTypes?: Array<"full-time" | "part-time" | "contract" | "internship" | "freelance">;
  desiredSalary?: DesiredSalary;
  availabilityDate?: Date;
  summary?: string;
  languages?: Array<Language>;
  certifications?: Array<Certification>;
  jobApplications?: Array<JobApplication>;
  rags?: Array<RagEntry>;
  ragContentSize: number;
}

export interface CandidateAI {
  id?: string;
  email: string;
  firstName: string;
  lastName: string;
  fullName: string;
  phone?: string;
  location?: Location;
  createdAt: Date;
  updatedAt: Date;
  lastLogin?: Date;
  profileImage?: string;
  status: "active" | "inactive" | "pending" | "banned";
  isAdmin: boolean;
  userType: "candidate";
  username: string;
  description?: string;
  resume?: string;
  skills?: Array<Skill>;
  experience?: Array<WorkExperience>;
  questions?: Array<CandidateQuestion>;
  education?: Array<Education>;
  preferredJobTypes?: Array<"full-time" | "part-time" | "contract" | "internship" | "freelance">;
  desiredSalary?: DesiredSalary;
  availabilityDate?: Date;
  summary?: string;
  languages?: Array<Language>;
  certifications?: Array<Certification>;
  jobApplications?: Array<any>;
  rags?: Array<RagEntry>;
  ragContentSize: number;
  isAI: boolean;
  age?: number;
  gender?: "female" | "male";
  ethnicity?: string;
}

export interface CandidateContact {
  email: string;
  phone?: string;
}

export interface CandidateListResponse {
  success: boolean;
  data?: Array<Candidate>;
  error?: ErrorDetail;
  meta?: Record<string, any>;
}

export interface CandidateQuestion {
  question: string;
  tunables?: Tunables;
}

export interface CandidateResponse {
  success: boolean;
  data?: Candidate;
  error?: ErrorDetail;
  meta?: Record<string, any>;
}

export interface Certification {
  id?: string;
  name: string;
  issuingOrganization: string;
  issueDate: Date;
  expirationDate?: Date;
  credentialId?: string;
  credentialUrl?: string;
}

export interface ChatContext {
  type: "job_search" | "job_requirements" | "candidate_chat" | "interview_prep" | "resume_review" | "general" | "generate_persona" | "generate_profile" | "generate_image" | "rag_search" | "skill_match";
  relatedEntityId?: string;
  relatedEntityType?: "job" | "candidate" | "employer";
  additionalContext?: Record<string, any>;
}

export interface ChatMessage {
  id?: string;
  sessionId: string;
  senderId?: string;
  status: "streaming" | "status" | "done" | "error";
  type: "binary" | "text" | "json";
  timestamp?: Date;
  role: "user" | "assistant" | "system" | "information" | "warning" | "error";
  content: string;
  tunables?: Tunables;
  metadata?: ChatMessageMetaData;
}

export interface ChatMessageError {
  id?: string;
  sessionId: string;
  senderId?: string;
  status: "streaming" | "status" | "done" | "error";
  type: "binary" | "text" | "json";
  timestamp?: Date;
  content: string;
}

export interface ChatMessageMetaData {
  model: "qwen2.5" | "flux-schnell";
  temperature: number;
  maxTokens: number;
  topP: number;
  frequencyPenalty?: number;
  presencePenalty?: number;
  stopSequences?: Array<string>;
  ragResults?: Array<ChromaDBGetResponse>;
  llmHistory?: Array<any>;
  evalCount: number;
  evalDuration: number;
  promptEvalCount: number;
  promptEvalDuration: number;
  options?: ChatOptions;
  tools?: Record<string, any>;
  timers?: Record<string, number>;
}

export interface ChatMessageRagSearch {
  id?: string;
  sessionId: string;
  senderId?: string;
  status: "streaming" | "status" | "done" | "error";
  type: "binary" | "text" | "json";
  timestamp?: Date;
  dimensions: number;
  content: Array<ChromaDBGetResponse>;
}

export interface ChatMessageStatus {
  id?: string;
  sessionId: string;
  senderId?: string;
  status: "streaming" | "status" | "done" | "error";
  type: "binary" | "text" | "json";
  timestamp?: Date;
  activity: "system" | "info" | "searching" | "thinking" | "generating" | "converting" | "generating_image" | "tooling" | "heartbeat";
  content: any;
}

export interface ChatMessageStreaming {
  id?: string;
  sessionId: string;
  senderId?: string;
  status: "streaming" | "status" | "done" | "error";
  type: "binary" | "text" | "json";
  timestamp?: Date;
  content: string;
}

export interface ChatMessageUser {
  id?: string;
  sessionId: string;
  senderId?: string;
  status: "streaming" | "status" | "done" | "error";
  type: "binary" | "text" | "json";
  timestamp?: Date;
  role: "user" | "assistant" | "system" | "information" | "warning" | "error";
  content: string;
  tunables?: Tunables;
}

export interface ChatOptions {
  seed?: number;
  numCtx?: number;
  temperature?: number;
}

export interface ChatQuery {
  prompt: string;
  tunables?: Tunables;
  agentOptions?: Record<string, any>;
}

export interface ChatSession {
  id?: string;
  userId?: string;
  guestId?: string;
  createdAt?: Date;
  lastActivity?: Date;
  title?: string;
  context: ChatContext;
  isArchived: boolean;
  systemPrompt?: string;
}

export interface ChromaDBGetResponse {
  ids: Array<string>;
  embeddings: Array<Array<number>>;
  documents: Array<string>;
  metadatas: Array<Record<string, any>>;
  distances: Array<number>;
  name: string;
  size: number;
  dimensions: number;
  query: string;
  queryEmbedding?: Array<number>;
  umapEmbedding2D?: Array<number>;
  umapEmbedding3D?: Array<number>;
}

export interface Citation {
  text: string;
  source: string;
  context: string;
  relevance: number;
}

export interface CreateCandidateRequest {
  email: string;
  username: string;
  password: string;
  firstName: string;
  lastName: string;
  phone?: string;
}

export interface CreateEmployerRequest {
  email: string;
  username: string;
  password: string;
  companyName: string;
  industry: string;
  companySize: string;
  companyDescription: string;
  websiteUrl?: string;
  phone?: string;
}

export interface CustomQuestion {
  question: string;
  answer: string;
}

export interface DataSourceConfiguration {
  id?: string;
  ragConfigId: string;
  name: string;
  sourceType: "document" | "website" | "api" | "database" | "internal";
  connectionDetails: Record<string, any>;
  processingPipeline: Array<ProcessingStep>;
  refreshSchedule?: string;
  lastRefreshed?: Date;
  status: "active" | "pending" | "error" | "processing";
  errorDetails?: string;
  metadata?: Record<string, any>;
}

export interface DesiredSalary {
  amount: number;
  currency: string;
  period: "hour" | "day" | "month" | "year";
}

export interface Document {
  id?: string;
  ownerId: string;
  filename: string;
  originalName: string;
  type: "pdf" | "docx" | "txt" | "markdown" | "image";
  size: number;
  uploadDate?: Date;
  options?: DocumentOptions;
  ragChunks?: number;
}

export interface DocumentContentResponse {
  documentId: string;
  filename: string;
  type: "pdf" | "docx" | "txt" | "markdown" | "image";
  content: string;
  size: number;
}

export interface DocumentListResponse {
  documents: Array<Document>;
  total: number;
}

export interface DocumentMessage {
  id?: string;
  sessionId: string;
  senderId?: string;
  status: "streaming" | "status" | "done" | "error";
  type: "binary" | "text" | "json";
  timestamp?: Date;
  document: Document;
  content?: string;
  converted: boolean;
}

export interface DocumentOptions {
  includeInRAG?: boolean;
  isJobDocument?: boolean;
  overwrite?: boolean;
}

export interface DocumentUpdateRequest {
  filename?: string;
  options?: DocumentOptions;
}

export interface EditHistory {
  content: string;
  editedAt: Date;
  editedBy: string;
}

export interface Education {
  id?: string;
  institution: string;
  degree: string;
  fieldOfStudy: string;
  startDate: Date;
  endDate?: Date;
  isCurrent: boolean;
  gpa?: number;
  achievements?: Array<string>;
  location?: Location;
}

export interface EmailVerificationRequest {
  token: string;
}

export interface Employer {
  id?: string;
  email: string;
  firstName: string;
  lastName: string;
  fullName: string;
  phone?: string;
  location?: Location;
  createdAt: Date;
  updatedAt: Date;
  lastLogin?: Date;
  profileImage?: string;
  status: "active" | "inactive" | "pending" | "banned";
  isAdmin: boolean;
  userType: "employer";
  companyName: string;
  industry: string;
  description?: string;
  companySize: string;
  companyDescription: string;
  websiteUrl?: string;
  jobs?: Array<Job>;
  companyLogo?: string;
  socialLinks?: Array<SocialLink>;
  poc?: PointOfContact;
}

export interface EmployerResponse {
  success: boolean;
  data?: Employer;
  error?: ErrorDetail;
  meta?: Record<string, any>;
}

export interface ErrorDetail {
  code: string;
  message: string;
  details?: any;
}

export interface Guest {
  id?: string;
  sessionId: string;
  createdAt: Date;
  lastActivity: Date;
  convertedToUserId?: string;
  ipAddress?: string;
  userAgent?: string;
}

export interface InterviewFeedback {
  id?: string;
  interviewId: string;
  reviewerId: string;
  technicalScore: number;
  culturalScore: number;
  overallScore: number;
  strengths: Array<string>;
  weaknesses: Array<string>;
  recommendation: "strong_hire" | "hire" | "no_hire" | "strong_no_hire";
  comments: string;
  createdAt: Date;
  updatedAt: Date;
  isVisible: boolean;
  skillAssessments?: Array<SkillAssessment>;
}

export interface InterviewSchedule {
  id?: string;
  applicationId: string;
  scheduledDate: Date;
  endDate: Date;
  interviewType: "phone" | "video" | "onsite" | "technical" | "behavioral";
  interviewers: Array<string>;
  location?: string | Location;
  notes?: string;
  feedback?: InterviewFeedback;
  status: "scheduled" | "completed" | "cancelled" | "rescheduled";
  meetingLink?: string;
}

export interface Job {
  id?: string;
  ownerId: string;
  ownerType: "candidate" | "employer" | "guest";
  title?: string;
  summary?: string;
  company?: string;
  description: string;
  requirements?: JobRequirements;
}

export interface JobApplication {
  id?: string;
  jobId: string;
  candidateId: string;
  status: "applied" | "reviewing" | "interview" | "offer" | "rejected" | "accepted" | "withdrawn";
  appliedDate: Date;
  updatedDate: Date;
  resumeVersion: string;
  coverLetter?: string;
  notes?: string;
  interviewSchedules?: Array<InterviewSchedule>;
  customQuestions?: Array<CustomQuestion>;
  candidateContact?: CandidateContact;
  decision?: ApplicationDecision;
}

export interface JobFull {
  id?: string;
  ownerId: string;
  ownerType: "candidate" | "employer" | "guest";
  title?: string;
  summary?: string;
  company?: string;
  description: string;
  requirements?: JobRequirements;
  location: Location;
  salaryRange?: SalaryRange;
  employmentType: "full-time" | "part-time" | "contract" | "internship" | "freelance";
  datePosted: Date;
  applicationDeadline?: Date;
  isActive: boolean;
  applicants?: Array<JobApplication>;
  department?: string;
  reportsTo?: string;
  benefits?: Array<string>;
  visaSponsorship?: boolean;
  featuredUntil?: Date;
  views: number;
  applicationCount: number;
}

export interface JobListResponse {
  success: boolean;
  data?: Array<Job>;
  error?: ErrorDetail;
  meta?: Record<string, any>;
}

export interface JobRequirements {
  technicalSkills: Requirements;
  experienceRequirements: Requirements;
  softSkills?: Array<string>;
  experience?: Array<string>;
  education?: Array<string>;
  certifications?: Array<string>;
  preferredAttributes?: Array<string>;
}

export interface JobRequirementsMessage {
  id?: string;
  sessionId: string;
  senderId?: string;
  status: "streaming" | "status" | "done" | "error";
  type: "binary" | "text" | "json";
  timestamp?: Date;
  title?: string;
  summary?: string;
  company?: string;
  description: string;
  requirements?: JobRequirements;
}

export interface JobResponse {
  success: boolean;
  data?: Job;
  error?: ErrorDetail;
  meta?: Record<string, any>;
}

export interface Language {
  language: string;
  proficiency: "basic" | "conversational" | "fluent" | "native";
}

export interface Location {
  city: string;
  state?: string;
  country: string;
  postalCode?: string;
  latitude?: number;
  longitude?: number;
  remote?: boolean;
  hybridOptions?: Array<string>;
  address?: string;
}

export interface LoginRequest {
  login: string;
  password: string;
}

export interface MFAData {
  message: string;
  deviceId: string;
  deviceName: string;
  codeSent: string;
  email: string;
}

export interface MFARequest {
  username: string;
  password: string;
  deviceId: string;
  deviceName: string;
}

export interface MFARequestResponse {
  mfaRequired: boolean;
  mfaData?: MFAData;
}

export interface MFAVerifyRequest {
  email: string;
  code: string;
  deviceId: string;
  rememberDevice: boolean;
}

export interface MessageReaction {
  userId: string;
  reaction: string;
  timestamp: Date;
}

export interface NotificationPreference {
  type: "email" | "push" | "in_app";
  events: Array<string>;
  isEnabled: boolean;
}

export interface PaginatedRequest {
  page: number;
  limit: number;
  sortBy?: string;
  sortOrder?: "asc" | "desc";
  filters?: Record<string, any>;
}

export interface PaginatedResponse {
  data: Array<any>;
  total: number;
  page: number;
  limit: number;
  totalPages: number;
  hasMore: boolean;
}

export interface PointOfContact {
  name: string;
  position: string;
  email: string;
  phone?: string;
}

export interface ProcessingStep {
  id?: string;
  type: "extract" | "transform" | "chunk" | "embed" | "filter" | "summarize";
  parameters: Record<string, any>;
  order: number;
  dependsOn?: Array<string>;
}

export interface RAGConfiguration {
  id?: string;
  userId: string;
  name: string;
  description?: string;
  dataSourceConfigurations: Array<DataSourceConfiguration>;
  embeddingModel: string;
  vectorStoreType: "chroma";
  retrievalParameters: RetrievalParameters;
  createdAt: Date;
  updatedAt: Date;
  version: number;
  isActive: boolean;
}

export interface RagContentMetadata {
  sourceFile: string;
  lineBegin: number;
  lineEnd: number;
  lines: number;
  chunkBegin?: number;
  chunkEnd?: number;
  metadata?: Record<string, any>;
}

export interface RagContentResponse {
  id: string;
  content: string;
  metadata: RagContentMetadata;
}

export interface RagEntry {
  name: string;
  description: string;
  enabled: boolean;
}

export interface RefreshToken {
  token: string;
  expiresAt: Date;
  device: string;
  ipAddress: string;
  isRevoked: boolean;
  revokedReason?: string;
}

export interface Requirements {
  required?: Array<string>;
  preferred?: Array<string>;
}

export interface ResendVerificationRequest {
  email: string;
}

export interface RetrievalParameters {
  searchType: "similarity" | "mmr" | "hybrid" | "keyword";
  topK: number;
  similarityThreshold?: number;
  rerankerModel?: string;
  useKeywordBoost: boolean;
  filterOptions?: Record<string, any>;
  contextWindow: number;
}

export interface SalaryRange {
  min: number;
  max: number;
  currency: string;
  period: "hour" | "day" | "month" | "year";
  isVisible: boolean;
}

export interface SearchQuery {
  query: string;
  filters?: Record<string, any>;
  page: number;
  limit: number;
  sortBy?: string;
  sortOrder?: "asc" | "desc";
}

export interface Skill {
  id?: string;
  name: string;
  category: string;
  level: "beginner" | "intermediate" | "advanced" | "expert";
  yearsOfExperience?: number;
}

export interface SkillAssessment {
  skillName: string;
  score: number;
  comments?: string;
}

export interface SkillMatch {
  requirement: string;
  domain: string;
  status: "pending" | "complete" | "waiting" | "error";
  matchScore: number;
  assessment: string;
  citations?: Array<Citation>;
  description: string;
}

export interface SocialLink {
  platform: "linkedin" | "twitter" | "github" | "dribbble" | "behance" | "website" | "other";
  url: string;
}

export interface Tunables {
  enableRAG: boolean;
  enableTools: boolean;
  enableContext: boolean;
}

export interface UserActivity {
  id?: string;
  userId?: string;
  guestId?: string;
  activityType: "login" | "search" | "view_job" | "apply_job" | "message" | "update_profile" | "chat";
  timestamp: Date;
  metadata: Record<string, any>;
  ipAddress?: string;
  userAgent?: string;
  sessionId?: string;
}

export interface UserPreference {
  userId: string;
  theme: "light" | "dark" | "system";
  notifications: Array<NotificationPreference>;
  accessibility: AccessibilitySettings;
  dashboardLayout?: Record<string, any>;
  language: string;
  timezone: string;
  emailFrequency: "immediate" | "daily" | "weekly" | "never";
}

export interface WorkExperience {
  id?: string;
  companyName: string;
  position: string;
  startDate: Date;
  endDate?: Date;
  isCurrent: boolean;
  description: string;
  skills: Array<string>;
  location: Location;
  achievements?: Array<string>;
}

// ============================
// Date Conversion Functions
// ============================

// These functions convert API responses to properly typed objects
// with Date objects instead of ISO date strings

/**
 * Convert Analytics from API response, parsing date fields
 * Date fields: timestamp
 */
export function convertAnalyticsFromApi(data: any): Analytics {
  if (!data) return data;
  
  return {
    ...data,
    // Convert timestamp from ISO string to Date
    timestamp: new Date(data.timestamp),
  };
}
/**
 * Convert ApiMessage from API response, parsing date fields
 * Date fields: timestamp
 */
export function convertApiMessageFromApi(data: any): ApiMessage {
  if (!data) return data;
  
  return {
    ...data,
    // Convert timestamp from ISO string to Date
    timestamp: data.timestamp ? new Date(data.timestamp) : undefined,
  };
}
/**
 * Convert ApplicationDecision from API response, parsing date fields
 * Date fields: date
 */
export function convertApplicationDecisionFromApi(data: any): ApplicationDecision {
  if (!data) return data;
  
  return {
    ...data,
    // Convert date from ISO string to Date
    date: new Date(data.date),
  };
}
/**
 * Convert Attachment from API response, parsing date fields
 * Date fields: uploadedAt
 */
export function convertAttachmentFromApi(data: any): Attachment {
  if (!data) return data;
  
  return {
    ...data,
    // Convert uploadedAt from ISO string to Date
    uploadedAt: new Date(data.uploadedAt),
  };
}
/**
 * Convert Authentication from API response, parsing date fields
 * Date fields: resetPasswordExpiry, lastPasswordChange, lockedUntil
 */
export function convertAuthenticationFromApi(data: any): Authentication {
  if (!data) return data;
  
  return {
    ...data,
    // Convert resetPasswordExpiry from ISO string to Date
    resetPasswordExpiry: data.resetPasswordExpiry ? new Date(data.resetPasswordExpiry) : undefined,
    // Convert lastPasswordChange from ISO string to Date
    lastPasswordChange: new Date(data.lastPasswordChange),
    // Convert lockedUntil from ISO string to Date
    lockedUntil: data.lockedUntil ? new Date(data.lockedUntil) : undefined,
  };
}
/**
 * Convert BaseUser from API response, parsing date fields
 * Date fields: createdAt, updatedAt, lastLogin
 */
export function convertBaseUserFromApi(data: any): BaseUser {
  if (!data) return data;
  
  return {
    ...data,
    // Convert createdAt from ISO string to Date
    createdAt: new Date(data.createdAt),
    // Convert updatedAt from ISO string to Date
    updatedAt: new Date(data.updatedAt),
    // Convert lastLogin from ISO string to Date
    lastLogin: data.lastLogin ? new Date(data.lastLogin) : undefined,
  };
}
/**
 * Convert BaseUserWithType from API response, parsing date fields
 * Date fields: createdAt, updatedAt, lastLogin
 */
export function convertBaseUserWithTypeFromApi(data: any): BaseUserWithType {
  if (!data) return data;
  
  return {
    ...data,
    // Convert createdAt from ISO string to Date
    createdAt: new Date(data.createdAt),
    // Convert updatedAt from ISO string to Date
    updatedAt: new Date(data.updatedAt),
    // Convert lastLogin from ISO string to Date
    lastLogin: data.lastLogin ? new Date(data.lastLogin) : undefined,
  };
}
/**
 * Convert Candidate from API response, parsing date fields
 * Date fields: createdAt, updatedAt, lastLogin, availabilityDate
 */
export function convertCandidateFromApi(data: any): Candidate {
  if (!data) return data;
  
  return {
    ...data,
    // Convert createdAt from ISO string to Date
    createdAt: new Date(data.createdAt),
    // Convert updatedAt from ISO string to Date
    updatedAt: new Date(data.updatedAt),
    // Convert lastLogin from ISO string to Date
    lastLogin: data.lastLogin ? new Date(data.lastLogin) : undefined,
    // Convert availabilityDate from ISO string to Date
    availabilityDate: data.availabilityDate ? new Date(data.availabilityDate) : undefined,
  };
}
/**
 * Convert CandidateAI from API response, parsing date fields
 * Date fields: createdAt, updatedAt, lastLogin, availabilityDate
 */
export function convertCandidateAIFromApi(data: any): CandidateAI {
  if (!data) return data;
  
  return {
    ...data,
    // Convert createdAt from ISO string to Date
    createdAt: new Date(data.createdAt),
    // Convert updatedAt from ISO string to Date
    updatedAt: new Date(data.updatedAt),
    // Convert lastLogin from ISO string to Date
    lastLogin: data.lastLogin ? new Date(data.lastLogin) : undefined,
    // Convert availabilityDate from ISO string to Date
    availabilityDate: data.availabilityDate ? new Date(data.availabilityDate) : undefined,
  };
}
/**
 * Convert Certification from API response, parsing date fields
 * Date fields: issueDate, expirationDate
 */
export function convertCertificationFromApi(data: any): Certification {
  if (!data) return data;
  
  return {
    ...data,
    // Convert issueDate from ISO string to Date
    issueDate: new Date(data.issueDate),
    // Convert expirationDate from ISO string to Date
    expirationDate: data.expirationDate ? new Date(data.expirationDate) : undefined,
  };
}
/**
 * Convert ChatMessage from API response, parsing date fields
 * Date fields: timestamp
 */
export function convertChatMessageFromApi(data: any): ChatMessage {
  if (!data) return data;
  
  return {
    ...data,
    // Convert timestamp from ISO string to Date
    timestamp: data.timestamp ? new Date(data.timestamp) : undefined,
  };
}
/**
 * Convert ChatMessageError from API response, parsing date fields
 * Date fields: timestamp
 */
export function convertChatMessageErrorFromApi(data: any): ChatMessageError {
  if (!data) return data;
  
  return {
    ...data,
    // Convert timestamp from ISO string to Date
    timestamp: data.timestamp ? new Date(data.timestamp) : undefined,
  };
}
/**
 * Convert ChatMessageRagSearch from API response, parsing date fields
 * Date fields: timestamp
 */
export function convertChatMessageRagSearchFromApi(data: any): ChatMessageRagSearch {
  if (!data) return data;
  
  return {
    ...data,
    // Convert timestamp from ISO string to Date
    timestamp: data.timestamp ? new Date(data.timestamp) : undefined,
  };
}
/**
 * Convert ChatMessageStatus from API response, parsing date fields
 * Date fields: timestamp
 */
export function convertChatMessageStatusFromApi(data: any): ChatMessageStatus {
  if (!data) return data;
  
  return {
    ...data,
    // Convert timestamp from ISO string to Date
    timestamp: data.timestamp ? new Date(data.timestamp) : undefined,
  };
}
/**
 * Convert ChatMessageStreaming from API response, parsing date fields
 * Date fields: timestamp
 */
export function convertChatMessageStreamingFromApi(data: any): ChatMessageStreaming {
  if (!data) return data;
  
  return {
    ...data,
    // Convert timestamp from ISO string to Date
    timestamp: data.timestamp ? new Date(data.timestamp) : undefined,
  };
}
/**
 * Convert ChatMessageUser from API response, parsing date fields
 * Date fields: timestamp
 */
export function convertChatMessageUserFromApi(data: any): ChatMessageUser {
  if (!data) return data;
  
  return {
    ...data,
    // Convert timestamp from ISO string to Date
    timestamp: data.timestamp ? new Date(data.timestamp) : undefined,
  };
}
/**
 * Convert ChatSession from API response, parsing date fields
 * Date fields: createdAt, lastActivity
 */
export function convertChatSessionFromApi(data: any): ChatSession {
  if (!data) return data;
  
  return {
    ...data,
    // Convert createdAt from ISO string to Date
    createdAt: data.createdAt ? new Date(data.createdAt) : undefined,
    // Convert lastActivity from ISO string to Date
    lastActivity: data.lastActivity ? new Date(data.lastActivity) : undefined,
  };
}
/**
 * Convert DataSourceConfiguration from API response, parsing date fields
 * Date fields: lastRefreshed
 */
export function convertDataSourceConfigurationFromApi(data: any): DataSourceConfiguration {
  if (!data) return data;
  
  return {
    ...data,
    // Convert lastRefreshed from ISO string to Date
    lastRefreshed: data.lastRefreshed ? new Date(data.lastRefreshed) : undefined,
  };
}
/**
 * Convert Document from API response, parsing date fields
 * Date fields: uploadDate
 */
export function convertDocumentFromApi(data: any): Document {
  if (!data) return data;
  
  return {
    ...data,
    // Convert uploadDate from ISO string to Date
    uploadDate: data.uploadDate ? new Date(data.uploadDate) : undefined,
  };
}
/**
 * Convert DocumentMessage from API response, parsing date fields
 * Date fields: timestamp
 */
export function convertDocumentMessageFromApi(data: any): DocumentMessage {
  if (!data) return data;
  
  return {
    ...data,
    // Convert timestamp from ISO string to Date
    timestamp: data.timestamp ? new Date(data.timestamp) : undefined,
  };
}
/**
 * Convert EditHistory from API response, parsing date fields
 * Date fields: editedAt
 */
export function convertEditHistoryFromApi(data: any): EditHistory {
  if (!data) return data;
  
  return {
    ...data,
    // Convert editedAt from ISO string to Date
    editedAt: new Date(data.editedAt),
  };
}
/**
 * Convert Education from API response, parsing date fields
 * Date fields: startDate, endDate
 */
export function convertEducationFromApi(data: any): Education {
  if (!data) return data;
  
  return {
    ...data,
    // Convert startDate from ISO string to Date
    startDate: new Date(data.startDate),
    // Convert endDate from ISO string to Date
    endDate: data.endDate ? new Date(data.endDate) : undefined,
  };
}
/**
 * Convert Employer from API response, parsing date fields
 * Date fields: createdAt, updatedAt, lastLogin
 */
export function convertEmployerFromApi(data: any): Employer {
  if (!data) return data;
  
  return {
    ...data,
    // Convert createdAt from ISO string to Date
    createdAt: new Date(data.createdAt),
    // Convert updatedAt from ISO string to Date
    updatedAt: new Date(data.updatedAt),
    // Convert lastLogin from ISO string to Date
    lastLogin: data.lastLogin ? new Date(data.lastLogin) : undefined,
  };
}
/**
 * Convert Guest from API response, parsing date fields
 * Date fields: createdAt, lastActivity
 */
export function convertGuestFromApi(data: any): Guest {
  if (!data) return data;
  
  return {
    ...data,
    // Convert createdAt from ISO string to Date
    createdAt: new Date(data.createdAt),
    // Convert lastActivity from ISO string to Date
    lastActivity: new Date(data.lastActivity),
  };
}
/**
 * Convert InterviewFeedback from API response, parsing date fields
 * Date fields: createdAt, updatedAt
 */
export function convertInterviewFeedbackFromApi(data: any): InterviewFeedback {
  if (!data) return data;
  
  return {
    ...data,
    // Convert createdAt from ISO string to Date
    createdAt: new Date(data.createdAt),
    // Convert updatedAt from ISO string to Date
    updatedAt: new Date(data.updatedAt),
  };
}
/**
 * Convert InterviewSchedule from API response, parsing date fields
 * Date fields: scheduledDate, endDate
 */
export function convertInterviewScheduleFromApi(data: any): InterviewSchedule {
  if (!data) return data;
  
  return {
    ...data,
    // Convert scheduledDate from ISO string to Date
    scheduledDate: new Date(data.scheduledDate),
    // Convert endDate from ISO string to Date
    endDate: new Date(data.endDate),
  };
}
/**
 * Convert JobApplication from API response, parsing date fields
 * Date fields: appliedDate, updatedDate
 */
export function convertJobApplicationFromApi(data: any): JobApplication {
  if (!data) return data;
  
  return {
    ...data,
    // Convert appliedDate from ISO string to Date
    appliedDate: new Date(data.appliedDate),
    // Convert updatedDate from ISO string to Date
    updatedDate: new Date(data.updatedDate),
  };
}
/**
 * Convert JobFull from API response, parsing date fields
 * Date fields: datePosted, applicationDeadline, featuredUntil
 */
export function convertJobFullFromApi(data: any): JobFull {
  if (!data) return data;
  
  return {
    ...data,
    // Convert datePosted from ISO string to Date
    datePosted: new Date(data.datePosted),
    // Convert applicationDeadline from ISO string to Date
    applicationDeadline: data.applicationDeadline ? new Date(data.applicationDeadline) : undefined,
    // Convert featuredUntil from ISO string to Date
    featuredUntil: data.featuredUntil ? new Date(data.featuredUntil) : undefined,
  };
}
/**
 * Convert JobRequirementsMessage from API response, parsing date fields
 * Date fields: timestamp
 */
export function convertJobRequirementsMessageFromApi(data: any): JobRequirementsMessage {
  if (!data) return data;
  
  return {
    ...data,
    // Convert timestamp from ISO string to Date
    timestamp: data.timestamp ? new Date(data.timestamp) : undefined,
  };
}
/**
 * Convert MessageReaction from API response, parsing date fields
 * Date fields: timestamp
 */
export function convertMessageReactionFromApi(data: any): MessageReaction {
  if (!data) return data;
  
  return {
    ...data,
    // Convert timestamp from ISO string to Date
    timestamp: new Date(data.timestamp),
  };
}
/**
 * Convert RAGConfiguration from API response, parsing date fields
 * Date fields: createdAt, updatedAt
 */
export function convertRAGConfigurationFromApi(data: any): RAGConfiguration {
  if (!data) return data;
  
  return {
    ...data,
    // Convert createdAt from ISO string to Date
    createdAt: new Date(data.createdAt),
    // Convert updatedAt from ISO string to Date
    updatedAt: new Date(data.updatedAt),
  };
}
/**
 * Convert RefreshToken from API response, parsing date fields
 * Date fields: expiresAt
 */
export function convertRefreshTokenFromApi(data: any): RefreshToken {
  if (!data) return data;
  
  return {
    ...data,
    // Convert expiresAt from ISO string to Date
    expiresAt: new Date(data.expiresAt),
  };
}
/**
 * Convert UserActivity from API response, parsing date fields
 * Date fields: timestamp
 */
export function convertUserActivityFromApi(data: any): UserActivity {
  if (!data) return data;
  
  return {
    ...data,
    // Convert timestamp from ISO string to Date
    timestamp: new Date(data.timestamp),
  };
}
/**
 * Convert WorkExperience from API response, parsing date fields
 * Date fields: startDate, endDate
 */
export function convertWorkExperienceFromApi(data: any): WorkExperience {
  if (!data) return data;
  
  return {
    ...data,
    // Convert startDate from ISO string to Date
    startDate: new Date(data.startDate),
    // Convert endDate from ISO string to Date
    endDate: data.endDate ? new Date(data.endDate) : undefined,
  };
}

/**
 * Generic converter that automatically selects the right conversion function
 * based on the model type
 */
export function convertFromApi<T>(data: any, modelType: string): T {
  if (!data) return data;
  
  switch (modelType) {
    case 'Analytics':
      return convertAnalyticsFromApi(data) as T;
    case 'ApiMessage':
      return convertApiMessageFromApi(data) as T;
    case 'ApplicationDecision':
      return convertApplicationDecisionFromApi(data) as T;
    case 'Attachment':
      return convertAttachmentFromApi(data) as T;
    case 'Authentication':
      return convertAuthenticationFromApi(data) as T;
    case 'BaseUser':
      return convertBaseUserFromApi(data) as T;
    case 'BaseUserWithType':
      return convertBaseUserWithTypeFromApi(data) as T;
    case 'Candidate':
      return convertCandidateFromApi(data) as T;
    case 'CandidateAI':
      return convertCandidateAIFromApi(data) as T;
    case 'Certification':
      return convertCertificationFromApi(data) as T;
    case 'ChatMessage':
      return convertChatMessageFromApi(data) as T;
    case 'ChatMessageError':
      return convertChatMessageErrorFromApi(data) as T;
    case 'ChatMessageRagSearch':
      return convertChatMessageRagSearchFromApi(data) as T;
    case 'ChatMessageStatus':
      return convertChatMessageStatusFromApi(data) as T;
    case 'ChatMessageStreaming':
      return convertChatMessageStreamingFromApi(data) as T;
    case 'ChatMessageUser':
      return convertChatMessageUserFromApi(data) as T;
    case 'ChatSession':
      return convertChatSessionFromApi(data) as T;
    case 'DataSourceConfiguration':
      return convertDataSourceConfigurationFromApi(data) as T;
    case 'Document':
      return convertDocumentFromApi(data) as T;
    case 'DocumentMessage':
      return convertDocumentMessageFromApi(data) as T;
    case 'EditHistory':
      return convertEditHistoryFromApi(data) as T;
    case 'Education':
      return convertEducationFromApi(data) as T;
    case 'Employer':
      return convertEmployerFromApi(data) as T;
    case 'Guest':
      return convertGuestFromApi(data) as T;
    case 'InterviewFeedback':
      return convertInterviewFeedbackFromApi(data) as T;
    case 'InterviewSchedule':
      return convertInterviewScheduleFromApi(data) as T;
    case 'JobApplication':
      return convertJobApplicationFromApi(data) as T;
    case 'JobFull':
      return convertJobFullFromApi(data) as T;
    case 'JobRequirementsMessage':
      return convertJobRequirementsMessageFromApi(data) as T;
    case 'MessageReaction':
      return convertMessageReactionFromApi(data) as T;
    case 'RAGConfiguration':
      return convertRAGConfigurationFromApi(data) as T;
    case 'RefreshToken':
      return convertRefreshTokenFromApi(data) as T;
    case 'UserActivity':
      return convertUserActivityFromApi(data) as T;
    case 'WorkExperience':
      return convertWorkExperienceFromApi(data) as T;
    default:
      return data as T;
  }
}

/**
 * Convert array of items using the appropriate converter
 */
export function convertArrayFromApi<T>(data: any[], modelType: string): T[] {
  if (!data || !Array.isArray(data)) return data;
  return data.map(item => convertFromApi<T>(item, modelType));
}
// ============================
// Union Types
// ============================

export type User = Candidate | Employer;

// Export all types
export type { };
