import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import {
  ArrayUnique,
  IsArray,
  IsEmail,
  IsOptional,
  IsString,
  MinLength,
} from 'class-validator';

export class ProvisionParkOperatorDto {
  @ApiProperty({ example: '+84912000002' })
  @IsString()
  phone!: string;

  @ApiProperty({ example: 'Velik@2026', minLength: 8 })
  @IsString()
  @MinLength(8)
  password!: string;

  @ApiProperty({ example: 'Vận hành KCN VSIP' })
  @IsString()
  fullName!: string;

  @ApiPropertyOptional({ example: 'kcn-vsip@goodgo.vn' })
  @IsOptional()
  @IsEmail()
  email?: string;

  @ApiPropertyOptional({
    type: [String],
    description:
      'ID các KCN sẽ gán quyền vận hành cho user này (KCN phải chưa có owner).',
    example: ['seed-park-001'],
  })
  @IsOptional()
  @IsArray()
  @ArrayUnique()
  @IsString({ each: true })
  parkIds?: string[];
}
