// Enums
export enum Role {
  ADMIN = 'ADMIN',
  MANAGER = 'MANAGER',
  CHIEF_MANAGER = 'CHIEF_MANAGER'
}

export enum TaskStatus {
  PENDING = 'PENDING',
  IN_PROGRESS = 'IN_PROGRESS',
  COMPLETED = 'COMPLETED',
  OVERDUE = 'OVERDUE'
}

export enum NotificationType {
  TASK_ASSIGNED = 'TASK_ASSIGNED',
  TASK_DEADLINE = 'TASK_DEADLINE',
  MESSAGE_RECEIVED = 'MESSAGE_RECEIVED',
  PERMISSION_REQUEST = 'PERMISSION_REQUEST',
  SYSTEM_ALERT = 'SYSTEM_ALERT',
  CLIENT_UPDATE = 'CLIENT_UPDATE',
  DOCUMENT_UPLOAD = 'DOCUMENT_UPLOAD'
}

export enum FolderStatus {
  PENDING = 'PENDING',
  FINISHED = 'FINISHED',
  PROGRESS = 'PROGRESS',
  URGENT = 'URGENT'
}

export enum DocumentType {
  // Facture
  HEALTH_INVOICE = 'HEALTH_INVOICE',
  OTHER_INVOICE = 'OTHER_INVOICE',
  // Correspondance
  MAIL_COURRIER_MANUSCRIT = 'MAIL_COURRIER_MANUSCRIT',
  MAIL_COURRIER_DACTYLOGRAPHIE = 'MAIL_COURRIER_DACTYLOGRAPHIE',
  MAIL_LETTRE_RECOMMANDEE = 'MAIL_LETTRE_RECOMMANDEE',
  MAIL_LETTRE_ADMINISTRATIVE = 'MAIL_LETTRE_ADMINISTRATIVE',
  MAIL_LETTRE_MOTIVATION = 'MAIL_LETTRE_MOTIVATION',
  MAIL_LETTRE_RECLAMATION = 'MAIL_LETTRE_RECLAMATION',
  MAIL_LETTRE_RESILIATION = 'MAIL_LETTRE_RESILIATION',
  MAIL_LETTRE_INVITATION = 'MAIL_LETTRE_INVITATION',
  EMAIL_PROFESSIONNEL = 'EMAIL_PROFESSIONNEL',
  EMAIL_DEMANDE_REPONSE = 'EMAIL_DEMANDE_REPONSE',
  EMAIL_CONVOCATION = 'EMAIL_CONVOCATION',
  EMAIL_CONFIRMATION = 'EMAIL_CONFIRMATION',
  // Documents officiels de correspondance
  OFFICIAL_CONVOCATION = 'OFFICIAL_CONVOCATION',
  OFFICIAL_AVIS = 'OFFICIAL_AVIS',
  OFFICIAL_NOTIFICATION = 'OFFICIAL_NOTIFICATION',
  OFFICIAL_COMPTE_RENDU = 'OFFICIAL_COMPTE_RENDU',
  OFFICIAL_RAPPORT_ACTIVITE = 'OFFICIAL_RAPPORT_ACTIVITE',
  // Other document types
  APPOINTMENT_DEED = 'APPOINTMENT_DEED',
  IDENTITY_CARD = 'IDENTITY_CARD',
  DAY_PERMIT = 'DAY_PERMIT',
  PASSPORT = 'PASSPORT',
  EMPLOYMENT_CONTRACT = 'EMPLOYMENT_CONTRACT',
  ENTRY_INVENTORY = 'ENTRY_INVENTORY',
  LEASE_AGREEMENT = 'LEASE_AGREEMENT',
  LAMAL_INSURANCE_POLICY = 'LAMAL_INSURANCE_POLICY',
  LIABILITY_INSURANCE_POLICY = 'LIABILITY_INSURANCE_POLICY',
  CAR_INSURANCE = 'CAR_INSURANCE',
  SUBSIDY_DECISION = 'SUBSIDY_DECISION',
  ECA_INSURANCE_POLICY = 'ECA_INSURANCE_POLICY',
  TAX_DECLARATION = 'TAX_DECLARATION',
  TAX_DECISION = 'TAX_DECISION',
  ANNUAL_REPORT = 'ANNUAL_REPORT',
  CORPORATE_FUND_DECISION = 'CORPORATE_FUND_DECISION',
  TRAVEL = 'TRAVEL',
  PHONE_CONTRACT = 'PHONE_CONTRACT',
  OTHER = 'OTHER'
}

export enum AccountPurpose {
  CURRENT = 'CURRENT',
  PRIVATE = 'PRIVATE',
  SAVINGS = 'SAVINGS'
}

export enum AccountStatus {
  ACTIVE = 'ACTIVE',
  INACTIVE = 'INACTIVE'
}

export enum PartnerType {
  HEALTH_INSURANCE = 'HEALTH_INSURANCE',
  COMPENSATION_FUND = 'COMPENSATION_FUND',
  JUSTICE_OF_PEACE = 'JUSTICE_OF_PEACE',
  TAX = 'TAX',
  MUNICIPALITY = 'MUNICIPALITY',
  RESIDENTS_CONTROL = 'RESIDENTS_CONTROL',
  EMPLOYER = 'EMPLOYER',
  AI_OFFICE = 'AI_OFFICE',
  HEALTH_INSURANCE_OFFICE = 'HEALTH_INSURANCE_OFFICE',
  DEBT_COLLECTION_OFFICE = 'DEBT_COLLECTION_OFFICE',
  PC_PENSION_FUND = 'PC_PENSION_FUND',
  SOCIAL_CSR = 'SOCIAL_CSR',
  RECOVERY_AGENCY = 'RECOVERY_AGENCY',
  LIABILITY_INSURANCE = 'LIABILITY_INSURANCE',
  LANDLORD = 'LANDLORD',
  HOME_INSURANCE = 'HOME_INSURANCE',
  TELECOMMUNICATION = 'TELECOMMUNICATION',
  BANK = 'BANK',
  SCHOLARSHIP_OFFICE = 'SCHOLARSHIP_OFFICE',
  GUARDIAN_CURATOR = 'GUARDIAN_CURATOR',
  SERAFE = 'SERAFE',
  DOCTOR = 'DOCTOR',
  CAR_SERVICE = 'CAR_SERVICE',
  NURSING_HOME = 'NURSING_HOME',
  SWISS_RAILWAYS = 'SWISS_RAILWAYS',
  MECHANIC = 'MECHANIC',
  INTRUM = 'INTRUM',
  MILITARY_TAX = 'MILITARY_TAX',
  OTHER = 'OTHER'
}

export enum EventStatus {
  DONE = 'DONE',
  TODO = 'TODO'
}

export enum InvoiceStatus {
  OPEN = 'OPEN',
  PAID = 'PAID',
  OVERDUE = 'OVERDUE',
  CANCELLED = 'CANCELLED'
}

export enum CommunicationType {
  RECEIVED = 'RECEIVED',
  SENT = 'SENT'
}

export enum TaskPriority {
  LOW = 'LOW',
  MEDIUM = 'MEDIUM',
  HIGH = 'HIGH'
}

// Interfaces
export interface User {
  id: number;
  createdAt: Date;
  email: string;
  username?: string;
  firstName: string;
  lastName: string;
  city: string;
  country: string;
  address: string;
  phone: string;
  isActive: boolean;
  role?: Role;
  profileImage?: string;
  bio?: string;
  socialLinks?: Record<string, string>;
  customFields?: Record<string, any>;
  lastLogin?: Date;
}

export interface Client {
  id: number;
  lastName: string;
  firstName: string;
  dateOfBirth?: Date;
    nationality?: string;
    socialSecurityNumber?: string;
  taxIdentificationNumber?: string;
  bankAccountNumbers?: Record<string, any>;
  creditCardInfo?: Record<string, any>;
  paymentCoordinates?: Record<string, any>;
  monthlySalary?: number;
  secondaryIncomeSources?: Record<string, any>;
  bonuses?: number;
  taxDeclarations?: Record<string, any>;
  payStubs?: Record<string, any>;
  expenseHistory?: Record<string, any>;
  consumerCredits?: Record<string, any>;
  debtAmount?: number;
  unpaidBills?: Record<string, any>;
  recurringSubscriptions?: Record<string, any>;
  bankAccountBalances?: Record<string, any>;
  savingsBook?: Record<string, any>;
  realEstateProperties?: Record<string, any>;
  netWorthEstimate?: number;
  vehicles?: Record<string, any>;
  jewelry?: Record<string, any>;
    street?: string;
    streetNumber?: string;
    postalCode?: string;
    stateCanton?: string;
    country?: string;
    mobilePhone?: string;
    otherPhone?: string;
    email?: string;
  creationDate: Date;
  updateDate: Date;
  customFields?: Record<string, any>;
  managerId?: number;
  manager?: User;
  status: FolderStatus;
  fatherName?: string;
  fatherContact?: string;
  fatherCountry?: string;
  motherName?: string;
  motherContact?: string;
  motherCountry?: string;
  partnerName?: string;
  partnerContact?: string;
  partnerCountry?: string;
}

export interface Task {
  id: number;
  title: string;
  description: string | null;
  startDate: Date | null;
  dueDate: Date | null;
  status: TaskStatus;
  priority: string | null;
  isAutomatic: boolean;
  completedAt: Date | null;
  duration: string | null;
  appreciation: string | null;
  responsibleId: number;
  responsible: User;
  clientId: number | null;
  client: Client | null;
  folderId: number | null;
  folder: Folder | null;
  calendarEventId: number | null;
  calendarEvent: CalendarEvent | null;
  isPrivate: boolean;
  collaborators: TaskCollaborator[];
  comments: TaskComment[];
  dependencies: TaskDependency[];
  dependentTasks: TaskDependency[];
  activityLogs: ActivityLog[];
}

export interface TaskCollaborator {
  id: number;
  taskId: number;
  task: Task;
  userId: number;
  user: User;
  role: string;
  addedAt: Date;
}

export interface TaskComment {
  id: number;
  createdAt: Date;
  content: string;
  taskId: number;
  task: Task;
  userId: number;
  user: User;
}

export interface TaskDependency {
  id: number;
  taskId: number;
  task: Task;
  dependentTaskId: number;
  dependentTask: Task;
  type?: string;
  createdAt: Date;
}

export interface Folder {
    id: number;
  createdAt: Date;
  status: FolderStatus;
  name: string;
  description?: string;
  clientId?: number;
  client?: Client;
    documents?: Document[];
}

export interface Document {
    id: number;
    name: string;
    fileType: string;
    path: string;
    isPermanent: boolean;
    documentCategory?: string;
    documentType?: DocumentType;
    uploadDate: Date;
    folderId?: number;
    folder?: Folder;
    clientId?: number;
    client?: Client;
    communicationId?: number;
    communication?: Communication;
    invoiceId?: number;
    invoice?: Invoice;
    parentId?: number;
    children?: Document[];
}

export interface Communication {
  id: number;
  createdAt: Date;
  type: CommunicationType;
  subject?: string;
  content: string;
  communicationType?: string;
  detailedType?: string;
  attachments?: Record<string, any>;
  clientId?: number;
  client?: Client;
  folderId?: number;
  folder?: Folder;
}

export interface CalendarEvent {
  id: number;
  title: string;
  description?: string;
  start: Date;
  end: Date;
  allDay: boolean;
  color?: string;
  userId?: number;
  user?: User;
}

export interface Notification {
  id: number;
  userId: number;
  user: User;
  type: NotificationType;
  content: string;
  isRead: boolean;
  createdAt: Date;
  relatedId?: number;
  relatedType?: string;
}

export interface Message {
  id: number;
  senderId: number;
  sender: User;
  receiverId: number;
  receiver: User;
  content: string;
  isRead: boolean;
  createdAt: Date;
}

export interface Invoice {
  id: number;
  invoiceNumber: string;
  issueDate: Date;
  dueDate: Date;
  amount: number;
  status: InvoiceStatus;
  description?: string;
  clientId?: number;
  client?: Client;
  folderId?: number;
  folder?: Folder;
}

export interface InvoiceComment {
  id: number;
  createdAt: Date;
  content: string;
  invoiceId: number;
  invoice: Invoice;
  userId: number;
  user: User;
}

export interface ActivityLog {
  id: number;
  createdAt: Date;
  action: string;
  entityType: string;
  entityId: number;
  description?: string;
  userId?: number;
  user?: User;
  folderId?: number;
  folder?: Folder;
  partnerId?: number;
  partner?: Partner;
  communicationId?: number;
  communication?: Communication;
  clientId?: number;
  client?: Client;
  taskId?: number;
  task?: Task;
}

export interface Partner {
  id: number;
  partnerType: PartnerType;
  name: string;
  contactName?: string;
  phone?: string;
  email?: string;
  address?: string;
  city?: string;
  country?: string;
  postalCode?: string;
  folderId: number;
  folder: Folder;
}

export interface CompteBancaire {
  id: number;
  bankName: string;
  accountNumber?: string;
  accountHolder?: string;
  accountPurpose: AccountPurpose;
  status: AccountStatus;
  creationDate: Date;
  updateDate: Date;
  folderId: number;
  folder: Folder;
}

export interface Emploi {
  id: number;
  employer: string;
  manager?: string;
  address?: string;
  phone?: string;
  city?: string;
  country?: string;
  contractStart?: Date;
  contractStatus?: string;
  creationDate: Date;
  updateDate: Date;
  folderId: number;
  folder: Folder;
}

export interface Relation {
  id: number;
  fatherName?: string;
  motherName?: string;
  spouseName?: string;
  relationType: string;
  contact?: string;
  creationDate: Date;
  updateDate: Date;
  folderId: number;
  folder: Folder;
}