import {
  Controller,
  Get,
  Post,
  Put,
  Delete,
  Body,
  Param,
  Query,
  ParseUUIDPipe,
  HttpCode,
  HttpStatus,
} from '@nestjs/common';
import { ItemTypeService } from './item-type.service';
import { CreateItemTypeDto, UpdateItemTypeDto } from './dto/item-type.dto';
import { BootstrapTableRequestDto } from '../commons/dto/bootstrap-table-request.dto'

@Controller('settings/item-types')
export class ItemTypeController {
  constructor(private readonly service: ItemTypeService) { }

  @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: CreateItemTypeDto) {
    return this.service.create(dto)
  }

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

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