import { Body, Controller, Get, Param, Patch, Post } from "@nestjs/common";
import { WarehousesService } from "./warehouses.service";

@Controller("warehouses")
export class WarehousesController {
  constructor(private readonly warehousesService: WarehousesService) {}

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

  @Post()
  create(@Body() body: { name: string; code: string; aliases?: string[] }) {
    return this.warehousesService.create(body);
  }

  @Patch(":id")
  update(
    @Param("id") id: string,
    @Body() body: Partial<{ name: string; code: string; aliases: string[]; active: boolean }>,
  ) {
    return this.warehousesService.update(id, body);
  }
}
