import type { MasterContext } from "../intelligence/types";

export interface BrandValidationResult {
  valid: boolean;
  issues: string[];
}

/** Ensure generated content references brand identity from master context. */
export function validateBrandAlignment(
  text: string,
  master: MasterContext,
): BrandValidationResult {
  const issues: string[] = [];
  const company = master.brand.companyName.toLowerCase();

  if (company.length > 3 && !text.toLowerCase().includes(company.split(" ")[0]!)) {
    issues.push("Caption may not reference the company name.");
  }

  return { valid: issues.length === 0, issues };
}
