import { BaseStatusDto } from 'src/core/modules/infrastructure/dto/base-status.dto';
import { SeasonPeriodEntity } from '../../domain/entities/season-period.entity';
import { EnumDays } from '../../constants';
import { ApiProperty } from '@nestjs/swagger';
import { IsObject, ValidateIf } from 'class-validator';
import { SeasonTypeModel } from 'src/modules/season-related/season-type/data/models/season-type.model';
import { Exclude } from 'class-transformer';
import { SeasonPeriodHolidayDto } from './season-period-holiday.dto';

export class UpdateSeasonPeriodDto
  extends BaseStatusDto
  implements SeasonPeriodEntity
{
  @ApiProperty({
    type: Object,
    required: true,
    example: {
      id: 'uuid',
      name: 'High Season',
    },
  })
  @IsObject()
  season_type: SeasonTypeModel;

  @ApiProperty({
    type: Date,
    required: true,
    example: '01/01/2024',
  })
  start_date: Date;

  @ApiProperty({
    type: Date,
    required: true,
    example: '30/12/2024',
  })
  end_date: Date;

  @ApiProperty({
    type: [String],
    required: false,
    example: [EnumDays.FRIDAY, EnumDays.MONDAY],
  })
  @ValidateIf((body) => body.days)
  days: EnumDays[];

  @ApiProperty({
    type: String,
    required: false,
    example: 'Hari Raya',
  })
  holiday_name: string;

  @Exclude()
  holidays: SeasonPeriodHolidayDto[];

  @Exclude()
  item_rates: any[];
}
