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

export class TextToMusicDto {
  @IsString()
  @IsNotEmpty()
  @MaxLength(500)
  prompt!: string;

  @IsOptional()
  @Type(() => Number)
  @IsInt()
  @Min(5)
  @Max(30)
  durationSeconds?: number;

  @IsOptional()
  @Type(() => Number)
  @IsInt()
  @Min(0)
  @Max(2147483647)
  seed?: number;

  @IsOptional()
  @IsIn(['oud', 'qanun', 'ney', 'violin', 'darbuka', 'riq', 'mixed'])
  instrument?: 'oud' | 'qanun' | 'ney' | 'violin' | 'darbuka' | 'riq' | 'mixed';

  @IsOptional()
  @Type(() => Boolean)
  @IsBoolean()
  solo?: boolean;

  @IsOptional()
  @IsString()
  @MaxLength(80)
  maqam?: string;

  @IsOptional()
  @IsString()
  @MaxLength(80)
  mood?: string;

  @IsOptional()
  @IsArray()
  @IsString({ each: true })
  @MaxLength(80, { each: true })
  instruments?: string[];

  @IsOptional()
  @IsString()
  @MaxLength(120)
  style?: string;

  @IsOptional()
  @IsIn(['slow', 'medium', 'fast'])
  tempo?: 'slow' | 'medium' | 'fast';

  @IsOptional()
  @IsIn(['none', 'light', 'medium'])
  percussion?: 'none' | 'light' | 'medium';

  @IsOptional()
  @Type(() => Boolean)
  @IsBoolean()
  vocals?: boolean;
}
