import { Injectable } from '@nestjs/common';
import { BaseDetailManager } from 'src/core/modules/domain/usecase/managers/base-detail.manager';
import { SeasonPeriodEntity } from '../../entities/season-period.entity';
import { RelationParam } from 'src/core/modules/domain/entities/base-filter.entity';

@Injectable()
export class DetailSeasonPeriodManager extends BaseDetailManager<SeasonPeriodEntity> {
  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: ['season_type'],

      // 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}.created_at`,
      `${this.tableName}.creator_name`,
      `${this.tableName}.editor_name`,
      `${this.tableName}.updated_at`,
      `${this.tableName}.status`,
      `${this.tableName}.start_date`,
      `${this.tableName}.end_date`,
      `${this.tableName}.days`,
      `${this.tableName}.holiday_name`,

      'season_type.id',
      'season_type.name',
    ];
  }

  get setFindProperties(): any {
    return {
      id: this.dataId,
    };
  }
}
