import { BaseFilterDto } from 'src/core/modules/infrastructure/dto/base-filter.dto';
import { FilterITimeGroupEntity } from '../../domain/entities/filter-time-group.entity';
import { ApiProperty } from '@nestjs/swagger';
import { ValidateIf } from 'class-validator';

export class FilterTimeGroupDto
  extends BaseFilterDto
  implements FilterITimeGroupEntity
{
  @ApiProperty({ type: 'string', required: false })
  @ValidateIf((body) => body.start_time_from)
  start_time_from: string;

  @ApiProperty({ type: 'string', required: false })
  @ValidateIf((body) => body.start_time_to)
  start_time_to: string;

  @ApiProperty({ type: 'string', required: false })
  @ValidateIf((body) => body.end_time_from)
  end_time_from: string;

  @ApiProperty({ type: 'string', required: false })
  @ValidateIf((body) => body.end_time_to)
  end_time_to: string;

  @ApiProperty({ type: 'string', required: false })
  @ValidateIf((body) => body.max_usage_time_from)
  max_usage_time_from: string;

  @ApiProperty({ type: 'string', required: false })
  @ValidateIf((body) => body.max_usage_time_to)
  max_usage_time_to: string;

  @ApiProperty({
    type: Date,
    required: false,
    example: '2024-01-01',
  })
  @ValidateIf((body) => body.date)
  date: Date;
}
