import { DEFAULT_SLOTS } from '$lib/content/defaults';
import { analyzeCopy, aggregateScore } from '$lib/seo';
import { getContent } from './content';

export function computeHealth(): { seo: number; geo: number } {
  const content = getContent();
  const analyses = DEFAULT_SLOTS
    .filter((s) => s.kind === 'multiline' || s.id.endsWith('_text'))
    .slice(0, 30)
    .map((s) => analyzeCopy(content.copy[s.id] ?? s.value, content.seo.primaryKeywords));
  return aggregateScore(analyses);
}
