import { StatusSpecSchema, type StatusSpec } from './types.js';

export interface ValidationResult {
  valid: boolean;
  data?: StatusSpec;
  blockers: string[];
  warnings: string[];
}

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