// ── TYPES & INTERFACES NDF ─────────────────────────────────────────────────

export interface Note {
    id: number;
    reference?: string;
    libelle?: string;
    categorie?: string;
    date?: string;
    montant?: number;
    statut?: string;
    collaborateur?: string;
    collaborateurEmail?: string;
    departement?: string;
    campus?: string;
    justificatif?: string;
    sharepointUrl?: string;
    fichiers?: string;
    participants?: string;
    nombreParticipants?: number;
    validateurN1Id?: number;
    validateurN2Id?: number;
    nomValidateurN1?: string;
    nomValidateurN2?: string;
    datePaiement?: string;
    moisPaiement?: number;
    anneePaiement?: number;
    commentaireN1?: string;
    commentaireN2?: string;
    motifRefus?: string;
    montantHT?: number;
    tauxTVA?: number;
    km?: number;
    indemniteKm?: number;
    lignesJson?: string;
    montantTTC?: number;
    sharepointFiles?: { fileName: string; uploadUrl: string }[];
}

export interface Profile {
    prenom?: string;
    nom?: string;
    email?: string;
    role?: string;
    departement?: string;
    campus?: string;
    poste?: string;
    TypeContrat?: string;
    DateEntree?: string;
}

export interface Categorie {
    id: number;
    Nom: string;
    Detail?: string;
    Icone?: string;
    PlafondParPersonne?: number;
    DescriptionPlafond?: string;
}

export interface TauxTVA {
    taux: number;
    libelle: string;
    categorie: string | null;
}

export interface Notification {
    id: number;
    Type: string;
    Titre: string;
    Message: string;
    NoteDeFraisId?: number;
    Lu: boolean;
    DateCreation: string;
}

export interface Participant {
    nom: string;
    prenom: string;
    societe?: string;
}

export interface Exception {
    id: number;
    reference?: string;
    montant?: number;
    libelle?: string;
    collaborateur?: string;
    email?: string;
    Motif?: string;
    Statut?: string;
    DateDemande?: string;
}

export interface PaiementConfig {
    JourPaiement: number;
}

export interface HistoriqueValidation {
    id: number;
    reference: string;
    libelle: string;
    montant: number;
    categorie: string;
    collaborateur: string;
    departement?: string;
    campus?: string;
    Niveau: string;
    Action: string;
    Commentaire?: string;
    MotifRefus?: string;
    NouveauStatut: string;
    DateAction: string;
}

export interface LigneNote {
    idTemp: string;
    date: string;
    categorie: string;
    libelle: string;
    montant: string;
    /** TVA multiple : tableau de { taux, montantTTC } */
    tvaItems: { taux: string; montantTTC: string }[];
    /** Rétrocompatibilité anciens brouillons */
    tauxTVA?: string;
    km: string;
    /** Puissance fiscale 3-7 CV */
    chevaux: string;
    description: string;
    files: File[];
    participants: Participant[];
    nombreParticipants: string;
    qrLink: string | null;
    qrUploaded: boolean;
    qrNoteRef: string;
}

export type DocStatut = 'en_attente' | 'valide' | 'refuse' | 'absent';

export type DocInfo = {
    fileName: string;
    sharepointUrl: string;
    updatedAt: string;
    statut: DocStatut;
    commentaire?: string | null;
} | null;
