import { Controller, Get } from '@nestjs/common';
import { ProfitShareFormulaReadOrchestrator } from '../domain/usecases/profit-share-formula-read.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';

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

  @Get()
  async detail(): Promise<SalesPriceFormulaEntity> {
    return await this.orchestrator.detail();
  }

  @Get('detail')
  async breakdown(): Promise<SalesPriceFormulaEntity[]> {
    return await this.orchestrator.index();
  }

  @Get('tax')
  async tax(): Promise<Partial<SalesPriceFormulaEntity>[]> {
    return await this.orchestrator.tax();
  }
}
