// Free/Pro split shared by every surface: a surface asks `tierAllows(tier, feature)`, never compares tiers itself.
export type Tier = "free" | "pro";

export const FEATURES = {
  check: "free",
  explanations: "free",
  highlight: "free",
  contrast: "free",
  outline: "free",
  "copy-markdown": "free",
  "site-scan": "pro",
  export: "pro",
  "saved-runs": "pro",
} as const satisfies Record<string, Tier>;

export type Feature = keyof typeof FEATURES;

export function tierAllows(tier: Tier, feature: Feature): boolean {
  return FEATURES[feature] === "free" || tier === "pro";
}

/** Shown next to results on every surface, because a clean automated result does not mean a page is accessible. */
export const AUTOMATED_LIMIT_NOTE =
  "Automated checks find only part of all WCAG failures. Test the page with a keyboard and a screen reader too; " +
  "a result without issues does not mean the page is accessible.";
