import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { LotType } from '@prisma/client';
import { IsEnum, IsInt, IsNumber, IsOptional, IsString, IsUUID, Min } from 'class-validator';

export class CreateLotDto {
  @ApiProperty() @IsUUID() spatialUnitId!: string;
  @ApiProperty({ example: 'A-201' }) @IsString() lotNumber!: string;

  @ApiProperty({ enum: LotType, default: LotType.APPARTEMENT })
  @IsEnum(LotType)
  type!: LotType;

  @ApiPropertyOptional() @IsOptional() @IsNumber() surfaceM2?: number;

  @ApiPropertyOptional({ default: 0 })
  @IsOptional()
  @IsInt()
  @Min(0)
  tantiemesGeneral?: number;
}
