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

@Controller("vendors")
export class VendorsController {
  constructor(private readonly vendorsService: VendorsService) {}

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

  @Post()
  create(@Body() body: { name: string; countryOfOrigin?: string }) {
    return this.vendorsService.create(body);
  }

  @Patch(":id")
  update(
    @Param("id") id: string,
    @Body() body: Partial<{ name: string; active: boolean; countryOfOrigin: string }>,
  ) {
    return this.vendorsService.update(id, body);
  }
}
