import {
  IsArray,
  IsString,
  IsOptional,
  IsBoolean,
  IsNumber,
  ValidateNested,
  IsIn,
} from "class-validator";
import { Type } from "class-transformer";
export type ChatRole = "system" | "user" | "assistant";
export class ChatMessageDto {
  @IsString() @IsIn(["system", "user", "assistant"]) role!: ChatRole;
  @IsString() content!: string;
}
export class ChatRequestDto {
  @IsString() model!: string;
  @IsArray()
  @ValidateNested({ each: true })
  @Type(() => ChatMessageDto)
  messages!: ChatMessageDto[];
  @IsOptional() @IsBoolean() stream?: boolean;
  @IsOptional() @IsNumber() temperature?: number;
  @IsOptional() @IsNumber() maxTokens?: number;
  @IsOptional() @IsString() systemPrompt?: string;
}
export interface ChatResponseDto {
  model: string;
  message: { role: ChatRole; content: string };
  done: boolean;
  totalDuration?: number;
  promptEvalCount?: number;
  evalCount?: number;
}
export interface ChatStreamChunkDto {
  model: string;
  message: { role: ChatRole; content: string };
  done: boolean;
}
