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

export class CreateBattleTokenDto {
  @ApiPropertyOptional({ description: 'Combatant template ID (for NPCs/Monsters)' })
  @IsOptional()
  @IsString()
  combatantId?: string;

  @ApiPropertyOptional({ description: 'Character ID (for PCs)' })
  @IsOptional()
  @IsString()
  characterId?: string;

  @ApiProperty({ description: 'Token display name' })
  @IsString()
  name: string;

  @ApiProperty({ description: 'X position on grid' })
  @IsNumber()
  positionX: number;

  @ApiProperty({ description: 'Y position on grid' })
  @IsNumber()
  positionY: number;

  @ApiProperty({ description: 'Current HP' })
  @IsInt()
  @Min(0)
  hpCurrent: number;

  @ApiProperty({ description: 'Maximum HP' })
  @IsInt()
  @Min(1)
  hpMax: number;

  @ApiPropertyOptional({ description: 'Initiative value' })
  @IsOptional()
  @IsInt()
  initiative?: number;

  @ApiPropertyOptional({ description: 'Active conditions', type: [String] })
  @IsOptional()
  @IsArray()
  @IsString({ each: true })
  conditions?: string[] = [];

  @ApiPropertyOptional({ description: 'Token size (1=Medium, 2=Large, etc.)', default: 1 })
  @IsOptional()
  @IsInt()
  @Min(1)
  @Max(6)
  size?: number = 1;
}
