import { Body, Controller, Post } from '@nestjs/common';
import { ProfitShareFormulaDataOrchestrator } from '../domain/usecases/profit-share-formula-data.orchestrator';
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
import { Public } from 'src/core/guards';
import { SalesPriceFormulaEntity } from '../../sales-price-formula/domain/entities/sales-price-formula.entity';
import { SalesPriceFormulaDto } from '../../sales-price-formula/infrastructure/dto/sales-price-formula.dto';

@ApiTags(`profit share formula - data`)
@Controller('v1/profit-share-formula')
@Public(false)
@ApiBearerAuth('JWT')
export class ProfitShareFormulaDataController {
  constructor(private orchestrator: ProfitShareFormulaDataOrchestrator) {}

  @Post()
  async create(
    @Body() data: SalesPriceFormulaDto,
  ): Promise<SalesPriceFormulaEntity> {
    return await this.orchestrator.update(data);
  }
}
