import { z } from 'zod';

// 角色状态枚举
export const characterStatusSchema = z.enum(['online', 'busy', 'offline']);

// 角色 Schema
export const characterSchema = z.object({
    id: z.string().uuid().optional(),
    name: z.string().min(1, 'Name is required'),
    tagline: z.string().optional(),
    avatar_path: z.string().optional(),
    description: z.string().optional(),

    compatibility: z.number().min(0).max(100).default(0),
    status: characterStatusSchema.default('online'),
    is_locked: z.boolean().default(false),
    is_active: z.boolean().default(true),
    sort_order: z.number().default(0),

    ai_system_prompt: z.string().optional(),
    ai_greeting: z.string().optional(),
    // Use z.string() as key type for Record to satisfy TypeScript and Zod v4+ alignment
    ai_personality: z.record(z.string(), z.any()).default({}),
    ai_voice_config: z.record(z.string(), z.any()).default({}),

    created_at: z.string().optional(),
    updated_at: z.string().optional(),
});

export type Character = z.infer<typeof characterSchema>;
