import {CustomSelectOptions} from "../ReactComponents";
import {GetRequestParams, RecordsResponse} from "../Axios";
import {Status} from "../DPass/Invitation";


export interface UserOverview
{
    user: {
        project_specialization: any;
        speciality: any;
        agreed_amount: any;
        hash_id:any;
        id: number
        dua_code: string
        firstname: string
        lastname: string
        email: string
        phone: string
        mobile_phone: string
    },
    total_contracts: number
    total_requests: number
    last_timesheet_month: number
    last_timesheet_year: number
}



/**
 * DELTIA
 */

export type UserDeltia = YearlyDeltia[]

export interface YearlyDeltia {
    year: string,
    deltia: MonthDeltio[]
}

export interface MonthDeltio {
    locked: any;
    updatedAt: string;
    temp_url: any;
    monthI: number
    month: string
    file: string | null
    isLocked: boolean
    updatedBy?: string
    file_uuid?: string | null
    projects?: string[];  // ← add this
}


export interface GetDeltiaResponse {
    template(template: any): unknown;
    a1_excel_file: A1ExcelFile;
    a1_pdf_files: A1PdfFile[];
    contract_type?: string;
}

export interface A1ExcelFile {
    A1_excel: any;
    project_codes: (string | null)[];
    months: number[];
    latestMonth: number | null;
    file: string | null;
}

export interface A1PdfFile {
    id: number;
    file_id: string | null;
    month_id: number;
    year: number;
    locked: number; // 0 | 1
    dua_code: string;
    file: string | null;
    project_codes: string | null;
    created_at: string;
    updated_at: string;
}

/**
 * FILES
 */
export interface UploadFileParams {
    file_category_id: number,
    subfolder_id: number,
    user_id: number,
    file: any,
    contract_code?: string
}

export interface Subfolder {
    temp_url: string;
    name: string
    value: number
    short_description: string
    last_updated: string
    description :string
    filepath: string | null
    ui_name : string
}

export interface PersonalFolderFile {
    file_category: any;
    is_deletable: boolean;
    temp_url: string;
    id: number
    digital_folder_id: number
    file_format_id: number
    dua_code: string
    subfolder_id: number
    subfolder_id_emergency: number
    file_category_name: string
    file_category_id: number
    protocol_number: string
    subject: string
    original_filename: string
    filepath: string
    uploaded_at: string
    uploader_user_id: string
    uploader_user_full_name: string
    subfolder_ui_name: string
    uuid: string
    extra_info: Record<string, string>

    hash_id?:string

}

// used in permanent employees files list
export interface FileWithAttachments {
    protocol_number: string,
    application: PersonalFolderFile | null
    attachments: PersonalFolderFile[]

}

export interface GetFilesParams extends GetRequestParams {
    search: string
    subfolder_id: string[]
    dua_code: string[]
    subfolder_id_emergency: string | number | null
    user_id?:number
    hash_id?:string
    active_role?:string
    project_code?:string
    contract_code?:string
    auth_user_id?:number

}
export interface GetFilesParamsContract extends GetRequestParams {
    search: string
    dua_code: string[]
    subfolder_id: string[]
    user_id?:number
    role?:string
    project_code?:string
    contract_code?:string
    auth_user_id?:number

}


//--  CONTRACTS    --///

export interface GetUserContractsParams extends GetRequestParams {

    search: string
    contract_types: string[]
    status: string

}

export interface UserContract  {
    id: any;
    hourly_rate: string;
    contract_cost: string;
    remaining_days: string;
    protocol_number: React.ReactNode;
    scientific_supervisor_fullname: React.ReactNode;
    unit_acronym: any;
    project_acronym: any;
    firsname: string;
    fathers_name: string;
    lastname: string;
    type: any;
    extra: any;

    contract_code: string
    project_code: string
    contract_start_date:  string
    contract_end_date: string
    contract_duration: string
    days_remaining: number
    scientific_supervisor: string
    contract_type: Status
    phone: string
    status: 0 | 1
    scientific_supervisor_phone: string

}

export interface UserContractDetailed {
    duration: string;
    contract_code: string
    project_code: string
    contract_start_date:  string
    contract_end_date: string
    contract_duration: string
    days_remaining: number
    scientific_supervisor: string
    type: Status
    phone: string
    status: 0 | 1
    scientific_supervisor_phone: string
    contract_file: PersonalFolderFile | null
    contract_form_file: PersonalFolderFile | null

}
