import type { Paginated } from '@/types/common';

export type EmployeeAdvancePayment = {
    id: number;
    employee_advance_id: number;
    paid_by_id: number | null;
    cash_transaction_id: number | null;
    amount: number;
    amount_formatted: string;
    description: string | null;
    paid_at: string;
    paid_at_formatted: string;
};

export type EmployeeAdvanceListItem = {
    id: number;
    employee_id: number;
    amount: number;
    amount_formatted: string;
    paid_amount: number;
    paid_amount_formatted: string;
    remaining_amount: number;
    remaining_amount_formatted: string;
    description: string;
    due_date_input: string;
    due_date_formatted: string;
    status: string;
    status_label: string;
    rejection_reason: string | null;
    employee_name: string;
    created_at_formatted: string;
    is_editable: boolean;
    can_verify: boolean;
    can_pay: boolean;
    payments?: EmployeeAdvancePayment[];
};

export type EmployeeAdvanceFormData = {
    amount: string;
    description: string;
    due_date: string;
};

export type PaginatedEmployeeAdvances = Paginated<EmployeeAdvanceListItem>;

export type EmployeeAdvanceSummary = {
    outstanding_amount: number;
    outstanding_amount_formatted: string;
    outstanding_count: number;
};

export type EmployeeAdvancePageProps = {
    employeeAdvances: PaginatedEmployeeAdvances;
    summary: EmployeeAdvanceSummary;
    authEmployeeId: number | null;
    canSubmit: boolean;
    filters: {
        search: string;
        sort?: string;
        direction?: 'asc' | 'desc';
        status?: string;
    };
};
