import { ApiProperty } from '@nestjs/swagger';
import { IsEmail, IsEnum, IsInt, IsNotEmpty, IsOptional, IsString, MaxLength, Min } from 'class-validator';
import { PlanType } from '../entities/client.entity';

export class CreateClientDto {
  @ApiProperty({ example: 'John', maxLength: 60 })
  @IsString()
  @IsNotEmpty()
  @MaxLength(60)
  firstName: string;

  @ApiProperty({ example: 'Doe', maxLength: 60 })
  @IsString()
  @IsNotEmpty()
  @MaxLength(60)
  lastName: string;

  @ApiProperty({ example: 'john.doe@example.com', maxLength: 100 })
  @IsEmail()
  @IsNotEmpty()
  @MaxLength(100)
  email: string;

  @ApiProperty({ enum: PlanType, default: PlanType.FREE })
  @IsEnum(PlanType)
  @IsOptional()
  plan?: PlanType = PlanType.FREE;

  @ApiProperty({ example: 5, minimum: 1 })
  @IsInt()
  @Min(1)
  @IsOptional()
  maxUsers?: number = 5;
}
