import { Injectable } from '@nestjs/common';
import { IndexVipCategoryManager } from './managers/index-vip-category.manager';
import { VipCategoryReadService } from '../../data/services/vip-category-read.service';
import { VipCategoryEntity } from '../entities/vip-category.entity';
import { PaginationResponse } from 'src/core/response/domain/ok-response.interface';
import { BaseReadOrchestrator } from 'src/core/modules/domain/usecase/orchestrators/base-read.orchestrator';
import { DetailVipCategoryManager } from './managers/detail-vip-category.manager';
import { TABLE_NAME } from 'src/core/strings/constants/table.constants';

@Injectable()
export class VipCategoryReadOrchestrator extends BaseReadOrchestrator<VipCategoryEntity> {
  constructor(
    private indexManager: IndexVipCategoryManager,
    private detailManager: DetailVipCategoryManager,
    private serviceData: VipCategoryReadService,
  ) {
    super();
  }

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

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