import { Controller, Get, Query } from "@nestjs/common";
import { Access } from "src/common/decorators/module-access.decorators";
import { ModuleAccessAllowed } from "src/common/decorators/modules-guard.decorators";
import { PaidTimeOffBankHoursService } from "src/time-and-attendance/paid-time-off/paid-time-off.service";

@Controller('paid-time-off')
export class PaidTimeOffController {
    constructor(
        private readonly paidTimeOffService: PaidTimeOffBankHoursService,
    ) { }

    @Get('totals')
    @ModuleAccessAllowed('timesheets', 'timesheets_approval', 'employee_management')
    async getPaidTimeOffTotalsForOneEmployee(
        @Access('email') email: string,
        @Query('email') employee_email?: string,
    ) {
        return this.paidTimeOffService.getPaidTimeOffTotalsWithEmployeeEmail(employee_email ?? email);
    }
}