import { ApiProperty } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { IsNotEmpty, IsNumber, IsOptional, IsString } from 'class-validator';
import { PagingReqDto } from 'src/common/dto/search';

export class SearchNearSlotDto {
  @ApiProperty({
    example: 21.00369935885945,
  })
  @IsNumber()
  @IsNotEmpty()
  @Type(() => Number)
  lat: number;

  @ApiProperty({
    example: 21.00369935885945,
  })
  @IsNumber()
  @IsNotEmpty()
  @Type(() => Number)
  lng: number;

  @ApiProperty({
    example: 1,
  })
  @IsNumber()
  @IsOptional()
  @Type(() => Number)
  radius?: number = 1;
}

export class SearchSlot extends PagingReqDto {
  @ApiProperty({ example: 'abc', required: false, type: String })
  @IsOptional()
  @IsString()
  name? = '';
}

export class SearchSlotByCursor extends PagingReqDto {
  @ApiProperty({ example: 'abc', required: false })
  @IsOptional()
  @IsNumber()
  @Type(() => Number)
  cursorId?: number;

  @ApiProperty({ example: 'abc', required: false, type: String })
  @IsOptional()
  @IsString()
  action: 'next' | 'prev' = 'next';

}
