import { ApiPropertyOptional } from '@nestjs/swagger';
import { IndustrialLeaseType, IndustrialListingStatus, IndustrialPropertyType } from '@prisma/client';
import { Type } from 'class-transformer';
import {
  IsString,
  IsNumber,
  IsEnum,
  IsOptional,
  IsBoolean,
  IsArray,
  IsObject,
  IsDateString,
  Min,
  MaxLength,
} from 'class-validator';

export class UpdateIndustrialListingDto {
  @ApiPropertyOptional({ enum: IndustrialPropertyType })
  @IsOptional()
  @IsEnum(IndustrialPropertyType)
  propertyType?: IndustrialPropertyType;

  @ApiPropertyOptional({ enum: IndustrialLeaseType })
  @IsOptional()
  @IsEnum(IndustrialLeaseType)
  leaseType?: IndustrialLeaseType;

  @ApiPropertyOptional({ enum: IndustrialListingStatus })
  @IsOptional()
  @IsEnum(IndustrialListingStatus)
  status?: IndustrialListingStatus;

  @ApiPropertyOptional()
  @IsOptional()
  @IsString()
  @MaxLength(300)
  title?: string;

  @ApiPropertyOptional()
  @IsOptional()
  @IsString()
  description?: string;

  @ApiPropertyOptional()
  @IsOptional()
  @IsNumber()
  @Type(() => Number)
  @Min(0)
  areaM2?: number;

  @ApiPropertyOptional()
  @IsOptional()
  @IsNumber()
  @Type(() => Number)
  ceilingHeightM?: number;

  @ApiPropertyOptional()
  @IsOptional()
  @IsNumber()
  @Type(() => Number)
  floorLoadTonM2?: number;

  @ApiPropertyOptional()
  @IsOptional()
  @IsNumber()
  @Type(() => Number)
  columnSpacingM?: number;

  @ApiPropertyOptional()
  @IsOptional()
  @IsNumber()
  @Type(() => Number)
  dockCount?: number;

  @ApiPropertyOptional()
  @IsOptional()
  @IsNumber()
  @Type(() => Number)
  craneCapacityTon?: number;

  @ApiPropertyOptional()
  @IsOptional()
  @IsBoolean()
  hasMezzanine?: boolean;

  @ApiPropertyOptional()
  @IsOptional()
  @IsBoolean()
  hasOfficeArea?: boolean;

  @ApiPropertyOptional()
  @IsOptional()
  @IsNumber()
  @Type(() => Number)
  officeAreaM2?: number;

  @ApiPropertyOptional()
  @IsOptional()
  @IsNumber()
  @Type(() => Number)
  priceUsdM2?: number;

  @ApiPropertyOptional()
  @IsOptional()
  @IsString()
  pricingUnit?: string;

  @ApiPropertyOptional()
  @IsOptional()
  @IsNumber()
  @Type(() => Number)
  totalLeasePrice?: number;

  @ApiPropertyOptional()
  @IsOptional()
  @IsNumber()
  @Type(() => Number)
  managementFee?: number;

  @ApiPropertyOptional()
  @IsOptional()
  @IsNumber()
  @Type(() => Number)
  depositMonths?: number;

  @ApiPropertyOptional()
  @IsOptional()
  @IsNumber()
  @Type(() => Number)
  minLeaseYears?: number;

  @ApiPropertyOptional()
  @IsOptional()
  @IsNumber()
  @Type(() => Number)
  maxLeaseYears?: number;

  @ApiPropertyOptional()
  @IsOptional()
  @IsDateString()
  leaseExpiry?: string;

  @ApiPropertyOptional()
  @IsOptional()
  @IsDateString()
  availableFrom?: string;

  @ApiPropertyOptional()
  @IsOptional()
  @IsNumber()
  @Type(() => Number)
  powerCapacityKva?: number;

  @ApiPropertyOptional()
  @IsOptional()
  @IsNumber()
  @Type(() => Number)
  waterSupplyM3Day?: number;

  @ApiPropertyOptional()
  @IsOptional()
  @IsArray()
  @IsObject({ each: true })
  media?: Record<string, unknown>[];
}
