import { IsString, IsOptional, IsNumber, IsInt, IsBoolean, IsArray, IsUUID, Length, Min } from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';

export class CreateItemDto {
  @ApiPropertyOptional({ description: 'Category ID' })
  @IsOptional()
  @IsUUID()
  category_id?: string;

  @ApiProperty({ description: 'Item name' })
  @IsString()
  @Length(1, 200)
  name: string;

  @ApiPropertyOptional({ description: 'Item description' })
  @IsOptional()
  @IsString()
  description?: string;

  @ApiProperty({ description: 'Price in configured currency' })
  @IsNumber()
  @Min(0)
  price: number;

  @ApiPropertyOptional({ description: 'Image URL' })
  @IsOptional()
  @IsString()
  image_url?: string;

  @ApiProperty({ description: 'Item type (kit, rank, currency, command)' })
  @IsString()
  item_type: string;

  @ApiProperty({ description: 'Console commands to execute on purchase', type: [String] })
  @IsArray()
  @IsString({ each: true })
  delivery_commands: string[];

  @ApiPropertyOptional({ description: 'Purchase limit per player (null = unlimited)' })
  @IsOptional()
  @IsInt()
  @Min(1)
  limit_per_player?: number;

  @ApiPropertyOptional({ description: 'Is item enabled for sale' })
  @IsOptional()
  @IsBoolean()
  enabled?: boolean;
}
