import { BaseFilterDto } from 'src/core/modules/infrastructure/dto/base-filter.dto';
import { FilterItemEntity } from '../../domain/entities/filter-item.entity';
import { ApiProperty } from '@nestjs/swagger';
import { Transform } from 'class-transformer';

export class FilterItemDto extends BaseFilterDto implements FilterItemEntity {
  @ApiProperty({ type: ['string'], required: false })
  @Transform((body) => {
    return Array.isArray(body.value) ? body.value : [body.value];
  })
  item_categories: string[];

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

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

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

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

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

  @ApiProperty({
    type: Boolean,
    required: false,
  })
  @Transform((body) => body.value == 'true')
  all_item: boolean;

  show_to_booking: boolean;
}
