/**
 * cli:update-snapshot — validate.ts  (pure, no I/O)
 */
import { UpdateSnapshotInputSchema } from './types.js'
import type { ValidationResult } from './types.js'

export function validate(raw: unknown): ValidationResult {
  const parsed = UpdateSnapshotInputSchema.safeParse(raw)
  if (!parsed.success) {
    return {
      valid: false,
      errors: parsed.error.issues.map((i) => `${i.path.join('.') || '(root)'}: ${i.message}`),
      warnings: [],
    }
  }
  return { valid: true, errors: [], warnings: [], spec: parsed.data }
}
