import {
  IsOptional,
  IsEnum,
  IsDateString,
  IsBoolean,
  IsInt,
  Min,
} from 'class-validator';
import { ApiPropertyOptional } from '@nestjs/swagger';
import { LicenseType } from '@prisma/client';

export class UpdateLicenseDto {
  @ApiPropertyOptional({ description: 'License type', enum: LicenseType })
  @IsEnum(LicenseType)
  @IsOptional()
  type?: LicenseType;

  @ApiPropertyOptional({ description: 'End date (ISO 8601)' })
  @IsDateString()
  @IsOptional()
  endDate?: string;

  @ApiPropertyOptional({ description: 'Whether license is active' })
  @IsBoolean()
  @IsOptional()
  isActive?: boolean;

  @ApiPropertyOptional({ description: 'Maximum users allowed' })
  @IsInt()
  @Min(1)
  @IsOptional()
  maxUsers?: number;

  @ApiPropertyOptional({ description: 'Maximum clients allowed' })
  @IsInt()
  @Min(1)
  @IsOptional()
  maxClients?: number;
}
