import { FormalityLevel } from "@prisma/client"; import { IsString, IsEnum, IsOptional, IsBoolean, MinLength, MaxLength } from "class-validator"; /** * DTO for creating a new personality * Field names match the frontend API contract from @mosaic/shared Personality type. */ export class CreatePersonalityDto { @IsString({ message: "name must be a string" }) @MinLength(1, { message: "name must not be empty" }) @MaxLength(255, { message: "name must not exceed 255 characters" }) name!: string; @IsOptional() @IsString({ message: "description must be a string" }) @MaxLength(2000, { message: "description must not exceed 2000 characters" }) description?: string; @IsString({ message: "tone must be a string" }) @MinLength(1, { message: "tone must not be empty" }) @MaxLength(100, { message: "tone must not exceed 100 characters" }) tone!: string; @IsEnum(FormalityLevel, { message: "formalityLevel must be a valid FormalityLevel" }) formalityLevel!: FormalityLevel; @IsString({ message: "systemPromptTemplate must be a string" }) @MinLength(1, { message: "systemPromptTemplate must not be empty" }) systemPromptTemplate!: string; @IsOptional() @IsBoolean({ message: "isDefault must be a boolean" }) isDefault?: boolean; @IsOptional() @IsBoolean({ message: "isActive must be a boolean" }) isActive?: boolean; }