// lib/process/seeds/hail-quarterly-review.js — shim around the JSON spec.
//
// Mirrors hail-engagement-lifecycle.js. The review-synthesis stage targets the
// hail-blueprint-architect template (seeded by seedHailAgentTemplates), so this
// must seed AFTER that — lib/seeds.js enforces the order.

import { readFileSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
import { dirname, join } from 'node:path';
import { upsertDefinition } from '../definitions.js';

const __dirname = dirname(fileURLToPath(import.meta.url));

export const HAIL_QUARTERLY_REVIEW_SLUG = 'hail-quarterly-review';

let _cachedSpec = null;
export function getHailQuarterlyReviewSpec() {
  if (!_cachedSpec) _cachedSpec = JSON.parse(readFileSync(join(__dirname, 'specs', 'hail-quarterly-review.json'), 'utf8'));
  return _cachedSpec;
}

export function seedHailQuarterlyReview() {
  const spec = getHailQuarterlyReviewSpec();
  return upsertDefinition(spec, { source_spec_json: JSON.stringify(spec) });
}
