import { ApiPropertyOptional } from '@nestjs/swagger';
import { IndustrialParkStatus } from '@prisma/client';
import { Type } from 'class-transformer';
import {
  IsString,
  IsNumber,
  IsEnum,
  IsOptional,
  IsArray,
  IsObject,
  IsBoolean,
  Min,
  Max,
} from 'class-validator';

export class UpdateIndustrialParkDto {
  @ApiPropertyOptional({ example: 'KCN VSIP Hải Phòng II' })
  @IsOptional()
  @IsString()
  name?: string;

  @ApiPropertyOptional({ example: 'VSIP Hai Phong II Industrial Park' })
  @IsOptional()
  @IsString()
  nameEn?: string;

  @ApiPropertyOptional({ example: 'VSIP Group' })
  @IsOptional()
  @IsString()
  developer?: string;

  @ApiPropertyOptional({ example: 'VSIP Joint Venture' })
  @IsOptional()
  @IsString()
  operator?: string;

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

  @ApiPropertyOptional({ example: 80 })
  @IsOptional()
  @IsNumber()
  @Type(() => Number)
  @Min(0)
  @Max(100)
  occupancyRate?: number;

  @ApiPropertyOptional({ example: 180 })
  @IsOptional()
  @IsNumber()
  @Type(() => Number)
  @Min(0)
  remainingAreaHa?: number;

  @ApiPropertyOptional({ example: 160 })
  @IsOptional()
  @IsNumber()
  @Type(() => Number)
  @Min(0)
  tenantCount?: number;

  @ApiPropertyOptional({ example: 85 })
  @IsOptional()
  @IsNumber()
  @Type(() => Number)
  landRentUsdM2Year?: number;

  @ApiPropertyOptional({ example: 5.5 })
  @IsOptional()
  @IsNumber()
  @Type(() => Number)
  rbfRentUsdM2Month?: number;

  @ApiPropertyOptional({ example: 4.5 })
  @IsOptional()
  @IsNumber()
  @Type(() => Number)
  rbwRentUsdM2Month?: number;

  @ApiPropertyOptional({ example: 0.7 })
  @IsOptional()
  @IsNumber()
  @Type(() => Number)
  managementFeeUsd?: number;

  @ApiPropertyOptional()
  @IsOptional()
  @IsObject()
  infrastructure?: Record<string, unknown>;

  @ApiPropertyOptional()
  @IsOptional()
  @IsObject()
  connectivity?: Record<string, unknown>;

  @ApiPropertyOptional()
  @IsOptional()
  @IsObject()
  incentives?: Record<string, unknown>;

  @ApiPropertyOptional({ example: ['electronics', 'logistics'] })
  @IsOptional()
  @IsArray()
  @IsString({ each: true })
  targetIndustries?: string[];

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

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

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

  @ApiPropertyOptional()
  @IsOptional()
  @IsString()
  ownerId?: string | null;
}
