import type { Shift } from "./shift.models";
import type { Expense } from "src/modules/timesheets/models/expense.models";

export const TIME_FORMAT_PATTERN = /^(\d{2}:\d{2})?$/;
export const DATE_FORMAT_PATTERN = /^\d{4}-\d{2}-\d{2}$/;

export interface TimesheetResponse {
    employee_fullname: string;
    timesheets: Timesheet[];
}

export interface Timesheet {
    timesheet_id: number;
    is_approved: boolean;
    weekly_hours: TotalHours;
    weekly_expenses: TotalExpenses;
    days: TimesheetDay[];
}

export interface TimesheetDay {
    date: string;   // YYYY-MM-DD
    daily_hours: TotalHours;
    daily_expenses: TotalExpenses;
    shifts: Shift[];
    expenses: Expense[];
}

export interface TotalHours {
    regular: number;
    evening: number;
    emergency: number;
    overtime: number;
    vacation: number;
    holiday: number;
    sick: number;
    absent: number;
}

export interface TotalExpenses {
    expenses: number;
    per_diem: number;
    on_call: number;
    mileage: number;
}

// export const test_timesheets: Timesheet[] = [
//     {
//         timehsid: 1,
//         is_approved: false,
//         weekly_hours: { regular: 8, evening: 0, emergency: 0, overtime: 0, vacation: 0, holiday: 0, sick: 0, absent: 0 },
//         weekly_expenses: { expenses: 15.5, mileage: 0 },
//         days: [
//             {
//                 date: '2025-10-18',
//                 daily_hours: { regular: 8, evening: 0, emergency: 0, overtime: 0, vacation: 0, holiday: 0, sick: 0, absent: 0 },
//                 daily_expenses: { expenses: 15.5, mileage: 0 },
//                 shifts: [
//                     { id: 101, date: '2025-01-06', type: 'REGULAR', start_time: '08:00', end_time: '12:00', comment: 'blah',    is_approved: false, is_remote: false, },
//                     { id: 102, date: '2025-01-06', type: 'REGULAR', start_time: '13:00', end_time: '17:00', comment: undefined, is_approved: false, is_remote: false, },
//                 ],
//                 expenses: [
//                     { id: 201, date: '2025-01-06', type: 'EXPENSES', amount: 15.5, comment: 'Lunch receipt', is_approved: false, },
//                 ],
//             },
//         ],
//     },
//     {
//         id: 2,
//         is_approved: true,
//         weekly_hours: {
//             regular: 0,
//             evening: 0,
//             emergency: 0,
//             overtime: 8,
//             vacation: 0,
//             holiday: 0,
//             sick: 0,
//             absent: 0,
//         },
//         weekly_expenses: {
//             expenses: 0,
//             mileage: 32.4,
//         },
//         days: [
//             {
//                 date: '2025-10-27',
//                 daily_hours: {
//                     regular: 0,
//                     evening: 0,
//                     emergency: 0,
//                     overtime: 8,
//                     vacation: 0,
//                     holiday: 0,
//                     sick: 0,
//                     absent: 0,
//                 },
//                 daily_expenses: {
//                     expenses: 0,
//                     mileage: 32.4,
//                 },
//                 shifts: [
//                     { id: 101, date: '2025-10-27', type: 'REGULAR', start_time: '08:00', end_time: '12:00', comment: undefined, is_approved: false, is_remote: false, },
//                     { id: 102, date: '2025-10-27', type: 'REGULAR', start_time: '13:00', end_time: '17:00', comment: undefined, is_approved: false, is_remote: false, },
//                 ],
//                 expenses: [
//                     {
//                         id: 202,
//                         date: '2025-10-27',
//                         type: 'MILEAGE',
//                         amount: 0,
//                         mileage: 32.4,
//                         comment: 'Travel to client site',
//                         is_approved: true,
//                     },
//                 ],
//             },
//         ],
//     },
// ];
