import { Type } from 'class-transformer';
import { IsBoolean, IsIn, IsInt, IsOptional, IsString, Length, Max, Min } from 'class-validator';

export class SearchRiotUserDto {
  @IsString()
  @Length(2, 64)
  gameName: string;

  @IsString()
  @Length(2, 16)
  tagLine: string;

  @IsString()
  @IsIn(['KR', 'NA1', 'EUW1', 'EUN1', 'JP1'])
  region: string;
}

export class CollectMatchesDto extends SearchRiotUserDto {
  @IsOptional()
  @Type(() => Number)
  @IsInt()
  @Min(1)
  @Max(100)
  matchCount?: number;
}

export class RiotAccountSuggestionQueryDto {
  @IsString()
  @Length(1, 80)
  query: string;

  @IsOptional()
  @IsString()
  @Length(1, 16)
  tagLine?: string;

  @IsOptional()
  @Type(() => Number)
  @IsInt()
  @Min(1)
  @Max(10)
  limit?: number = 6;
}

export class ChampionSuggestionQueryDto {
  @IsString()
  @Length(1, 80)
  query: string;

  @IsOptional()
  @Type(() => Number)
  @IsInt()
  @Min(1)
  @Max(10)
  limit?: number = 6;
}

export class LookupAnalysisDto extends SearchRiotUserDto {
  @IsOptional()
  @Type(() => Boolean)
  @IsBoolean()
  syncIfMissing?: boolean = true;
}
