import { Injectable } from '@nestjs/common';
import { IndexSeasonTypeManager } from './managers/index-season-type.manager';
import { SeasonTypeReadService } from '../../data/services/season-type-read.service';
import { SeasonTypeEntity } from '../entities/season-type.entity';
import { PaginationResponse } from 'src/core/response/domain/ok-response.interface';
import { BaseReadOrchestrator } from 'src/core/modules/domain/usecase/orchestrators/base-read.orchestrator';
import { DetailSeasonTypeManager } from './managers/detail-season-type.manager';
import { TABLE_NAME } from 'src/core/strings/constants/table.constants';

@Injectable()
export class SeasonTypeReadOrchestrator extends BaseReadOrchestrator<SeasonTypeEntity> {
  constructor(
    private indexManager: IndexSeasonTypeManager,
    private detailManager: DetailSeasonTypeManager,
    private serviceData: SeasonTypeReadService,
  ) {
    super();
  }

  async index(params): Promise<PaginationResponse<SeasonTypeEntity>> {
    this.indexManager.setFilterParam(params);
    this.indexManager.setService(this.serviceData, TABLE_NAME.SEASON_TYPE);
    await this.indexManager.execute();
    return this.indexManager.getResult();
  }

  async detail(dataId: string): Promise<SeasonTypeEntity> {
    this.detailManager.setData(dataId);
    this.detailManager.setService(this.serviceData, TABLE_NAME.SEASON_TYPE);
    await this.detailManager.execute();
    return this.detailManager.getResult();
  }
}
