import { BaseFilterDto } from 'src/core/modules/infrastructure/dto/base-filter.dto';
import { FilterSeasonPeriodEntity } from '../../domain/entities/filter-season-period.entity';
import { EnumDays } from '../../constants';
import { ApiProperty } from '@nestjs/swagger';
import { Transform } from 'class-transformer';

export class FilterSeasonPeriodDto
  extends BaseFilterDto
  implements FilterSeasonPeriodEntity
{
  @ApiProperty({ type: Date, required: false })
  start_date: Date;

  @ApiProperty({ type: Date, required: false })
  end_date: Date;

  @ApiProperty({ type: ['string'], required: false })
  @Transform((body) => {
    return Array.isArray(body.value) ? body.value : [body.value];
  })
  holiday_names: string[];

  @ApiProperty({ type: ['string'], required: false })
  @Transform((body) => {
    return Array.isArray(body.value) ? body.value : [body.value];
  })
  days: EnumDays[];

  @ApiProperty({ type: ['string'], required: false })
  @Transform((body) => {
    return Array.isArray(body.value) ? body.value : [body.value];
  })
  season_type_ids: string[];
}
