import { z } from 'zod';

export const aiConfigSchema = z
  .object({
    id: z.number(),
    provider: z.string(),
    baseUrl: z.string(),
    hasApiKey: z.boolean(),
    hasDatabaseKey: z.boolean(),
    maskedApiKey: z.string().nullable(),
    keySource: z.enum(['database', 'environment', 'none']),
    defaultModel: z.string().nullable(),
    enabled: z.boolean(),
    supportsVision: z.boolean(),
    timeoutMs: z.number(),
    reasoningEffort: z.string().nullable(),
    verified: z.boolean(),
    lastTestedAt: z.string().nullable(),
    lastTestLatencyMs: z.number().nullable(),
    createdAt: z.string(),
    updatedAt: z.string(),
  })
  .passthrough();

export const aiConfigEnvelopeSchema = z
  .object({ success: z.boolean(), data: aiConfigSchema })
  .passthrough();

/** 导入任务 */
