import {
    Controller,
    Get,
    Post,
    Put,
    Delete,
    Body,
    Param,
    Query,
    ParseUUIDPipe,
    HttpCode,
    HttpStatus,
} from '@nestjs/common'
import { BankService } from './bank.service'
import { CreateBankDto, UpdateBankDto } from './dto/bank.dto'
import { BootstrapTableRequestDto } from 'src/commons/dto/bootstrap-table-request.dto'

@Controller('settings/banks')
export class BankController {
    constructor(private readonly service: BankService) {}

    @Get()
    findAll(@Query() query: BootstrapTableRequestDto) {
        return this.service.findAll(query)
    }

    @Get(':id')
    findOne(@Param('id', ParseUUIDPipe) id: string) {
        return this.service.findOne(id)
    }

    @Post()
    create(@Body() dto: CreateBankDto) {
        return this.service.create(dto)
    }

    @Put(':id')
    update(
        @Param('id', ParseUUIDPipe) id: string,
        @Body() dto: UpdateBankDto,
    ) {
        return this.service.update(id, dto)
    }

    @Delete(':id')
    @HttpCode(HttpStatus.NO_CONTENT)
    remove(@Param('id', ParseUUIDPipe) id: string) {
        return this.service.remove(id)
    }
}