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

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

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

  @ApiProperty({ example: 'CĐT Vinhomes' })
  @IsString()
  fullName!: string;

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

  @ApiPropertyOptional({
    type: [String],
    description:
      'ID các dự án sẽ gán quyền sở hữu cho CĐT này (dự án phải chưa có owner).',
    example: ['seed-project-001', 'seed-project-005'],
  })
  @IsOptional()
  @IsArray()
  @ArrayUnique()
  @IsString({ each: true })
  projectIds?: string[];
}
