import { z } from 'zod';

// 角色 Schema
export const characterSchema = z.object({
    id: z.string().optional(),
    name: z.string().optional().or(z.literal('')),
    avatar_path: z.string().optional().or(z.literal('')),
    description: z.string().optional().or(z.literal('')),

    is_locked: z.boolean().default(false),
    is_active: z.boolean().default(true),
    sort_order: z.number().default(0),

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

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

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