import { ApiProperty } from '@nestjs/swagger';
import { BookingType, SlotType } from '@prisma/client';
import { Type } from 'class-transformer';
import {
  IsArray,
  IsEnum,
  IsMilitaryTime,
  IsNotEmpty,
  IsNumber,
  IsOptional,
  IsString,
} from 'class-validator';

export class CreateSlotDto {
  @ApiProperty({
    example: 'Bãi Đỗ Xe 1',
  })
  @IsString()
  name: string;

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

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

  @ApiProperty({
    example: '116 Miếu Đầm',
  })
  @IsString()
  @IsNotEmpty()
  address: string;

  @ApiProperty({
    example: 'Nam Từ Liêm',
  })
  @IsString()
  @IsNotEmpty()
  district: string;

  @ApiProperty({
    example: 'Mễ Trì',
  })
  @IsString()
  @IsNotEmpty()
  ward: string;

  @ApiProperty({
    example: 'Hà Nội',
  })
  @IsString()
  @IsNotEmpty()
  city: string;

  @ApiProperty()
  @IsString()
  @IsOptional()
  destination: string;

  @ApiProperty({
    example: 5,
  })
  @IsNumber()
  @IsNotEmpty()
  total: number;

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

  @ApiProperty({
    example: '20:56',
  })
  @IsNotEmpty()
  @IsMilitaryTime()
  close: string;

  @ApiProperty({
    example: '20:56',
  })
  @IsNotEmpty()
  @IsMilitaryTime()
  open: string;

  @ApiProperty({
    example: 5,
  })
  @IsOptional()
  @IsArray()
  images: string[];

  @ApiProperty({
    example: BookingType.All,
  })
  @IsString()
  @IsEnum(BookingType)
  @IsOptional()
  alow_booking_type: BookingType = BookingType.All;

  @ApiProperty({
    example: SlotType.Orther,
  })
  @IsEnum(SlotType)
  @IsString()
  @IsOptional()
  slot_type: SlotType = SlotType.Orther;
}


export class VoteCommentDto {
  @ApiProperty()
  @IsNumber()
  @IsNotEmpty()
  source: number
}