import { Injectable } from '@nestjs/common';
import { BaseDetailManager } from 'src/core/modules/domain/usecase/managers/base-detail.manager';
import { SalesPriceFormulaEntity } from '../../entities/sales-price-formula.entity';
import { RelationParam } from 'src/core/modules/domain/entities/base-filter.entity';
import { FormulaType } from '../../../constants';

@Injectable()
export class DetailSalesPriceFormulaManager extends BaseDetailManager<SalesPriceFormulaEntity> {
  async prepareData(): Promise<void> {
    return;
  }

  async beforeProcess(): Promise<void> {
    return;
  }

  async afterProcess(): Promise<void> {
    return;
  }

  get relations(): RelationParam {
    return {
      // relation only join (for query purpose)
      joinRelations: [],

      // relation join and select (relasi yang ingin ditampilkan),
      selectRelations: [],

      // relation yang hanya ingin dihitung (akan return number)
      countRelations: [],
    };
  }

  get selects(): string[] {
    return [
      `${this.tableName}.id`,
      `${this.tableName}.formula_render`,
      `${this.tableName}.formula_string`,
      `${this.tableName}.editor_name`,
      `${this.tableName}.updated_at`,
      `${this.tableName}.created_at`,
    ];
  }

  get setFindProperties(): any {
    return {
      type: FormulaType.SALES_PRICE,
    };
  }
}
