export type ExpenseType = 'PER_DIEM' | 'MILEAGE' | 'EXPENSES' | 'PRIME_GARDE';

export const EXPENSE_TYPE: ExpenseType[] = ['PER_DIEM', 'MILEAGE', 'EXPENSES', 'PRIME_GARDE',];
export const TYPES_WITH_MILEAGE_ONLY: Readonly<ExpenseType[]> = ['MILEAGE'];
export const TYPES_WITH_AMOUNT_ONLY: Readonly<ExpenseType[]> = ['PER_DIEM', 'EXPENSES', 'PRIME_GARDE',];

export interface Expense {
    date: string;
    type: ExpenseType;
    amount: number;
    mileage?: number;
    comment: string;
    supervisor_comment?: string;
    is_approved: boolean;
}

export type ExpenseTotals = {
    amount: number;
    mileage: number;
    reimburseable_total?: number;
};

export interface PayPeriodExpenses {
    is_approved: boolean;
    expenses: Expense[];
    totals?: ExpenseTotals;
}

export interface UpsertExpense {
    old_expense: Expense;
    new_expense: Expense;
}

export const default_expense: Expense = {
    date: '',
    type: 'EXPENSES',
    amount: 0,
    comment: '',
    is_approved: false,
};

export const default_pay_period_expenses: PayPeriodExpenses = {
    is_approved: false,
    expenses: [],
}