import { z } from 'zod'; /** 字段置信度:AI 分级录入的唯一依据 */ export const confidenceSchema = z.enum(['high', 'medium', 'low']); export type Confidence = z.infer; /** * 字段级元数据。path 是扁平路径(如 specs.rearCamera[0].sensorModel), * 与 AI 接口返回的字段路径一一对应。 */ export const fieldMetaSchema = z.object({ path: z.string(), confidence: confidenceSchema, sourceUrl: z.url().optional(), verified: z.boolean().default(false), capturedAt: z.string(), }); export type FieldMeta = z.infer; /** ISO 日期字符串(只到日或 datetime 均可) */ export const dateStringSchema = z.string().refine((v) => !Number.isNaN(new Date(v).getTime()), { message: '不是有效日期', });