import { Body, Controller, Get, Param, ParseIntPipe, Patch, Post } from "@nestjs/common";
import { ModuleAccessAllowed } from "src/common/decorators/modules-guard.decorators";
import { Result } from "src/common/errors/result-error.factory";
import { Modules as ModulesEnum, Prisma } from "prisma/postgres/generated/prisma/client/postgres/client";
import { BankCodesService } from "src/time-and-attendance/bank-codes/bank-codes.service";

@Controller('bank-codes')
@ModuleAccessAllowed(ModulesEnum.employee_management)
export class BankCodesControllers {
    constructor(private readonly bankCodesService: BankCodesService) { }
    //_____________________________________________________________________________________________
    //                                  Deprecated or unused methods
    //_____________________________________________________________________________________________

    @Post()
    create(@Body() dto: Prisma.BankCodesCreateInput
    ): Promise<Result<boolean, string>> {
        return this.bankCodesService.create(dto);
    }

    @Get()
    findAll() {
        return this.bankCodesService.findAll();
    }

    @Patch(':id')
    update(@Param('id', ParseIntPipe) id: number, @Body() dto: Prisma.BankCodesUpdateInput
    ): Promise<Result<boolean, string>> {
        return this.bankCodesService.update(id, dto)
    }
}