import {
    Controller,
    Get,
    Post,
    Put,
    Delete,
    Body,
    Param,
    Query,
    ParseUUIDPipe,
    HttpCode,
    HttpStatus,
} from '@nestjs/common';
import { PricingHeaderService } from './pricing-header.service';
import { CreatePricingHeaderDto, UpdatePricingHeaderDto } from './dto/pricing-header.dto';
import { BootstrapTableRequestDto } from '../commons/dto/bootstrap-table-request.dto'

@Controller('settings/pricing-headers')
export class PricingHeaderController {
    constructor(private readonly service: PricingHeaderService) { }

    @Get()
    findAll(
        @Query() query: BootstrapTableRequestDto,
        @Query('itemTypeId') itemTypeId?: string,
    ) {
        return this.service.findAll(query, itemTypeId)
    }

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

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

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

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