import {
  Controller,
  Get,
  Post,
  Body,
  Patch,
  Param,
  Delete,
  Query,
} from '@nestjs/common';
import { IssuerBankAccountsService } from './issuer_bank_accounts.service';
import { Public } from '../auth/public.decorator';

@Controller('invoice-issuers')
export class IssuerBankAccountsController {
  constructor(
    private readonly bankAccountsService: IssuerBankAccountsService,
  ) {}

  @Public()
  @Get(':issuerId/bank-accounts')
  findAll(@Param('issuerId') issuerId: string) {
    return this.bankAccountsService.findAll(+issuerId);
  }

  @Public()
  @Post('bank-accounts')
  create(@Body() createDto: any) {
    return this.bankAccountsService.create(createDto);
  }

  @Public()
  @Patch('bank-accounts/:id')
  update(@Param('id') id: string, @Body() updateDto: any) {
    return this.bankAccountsService.update(+id, updateDto);
  }

  @Public()
  @Delete('bank-accounts/:id')
  remove(@Param('id') id: string) {
    return this.bankAccountsService.remove(+id);
  }
}
