/**
 * cli:aggregate-component-registry — validate.ts
 *
 * Structural Zod validation only. The "does this resolve on disk" check
 * happens in generate.ts after parsing — too detailed to bubble through
 * a generic ValidationResult.
 */
import {
  AggregateComponentRegistryInputSchema,
  type ValidationResult,
} from './types.js'

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