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 {
    has_preset_schedule: boolean;
    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;
}