import type { Locale } from "@/lib/i18n";

/** Decorative thumbnail tints (mapped to CSS module classes). */
export type Tint = "mint" | "coral" | "blue" | "violet" | "amber";

/** Illustration keys from the design's SVG library. */
export type Illust =
  | "chevron"
  | "layers"
  | "bars"
  | "orbit"
  | "search"
  | "network"
  | "grid"
  | "spark"
  | "terminal";

export type BlogAuthor = {
  name: string;
  role: string;
  /** 2-letter monogram for the avatar. */
  initials: string;
  bio?: string;
  twitter?: string;
  linkedin?: string;
};

export type BlogSeo = {
  metaTitle?: string;
  metaDescription?: string;
  ogImage?: string;
  keywords?: string[];
  canonical?: string;
  noindex?: boolean;
};

/** Raw frontmatter as authored in each post's MDX file. */
export type BlogFrontmatter = {
  title: string;
  slug: string;
  category: string;
  lang: Locale;
  date: string;
  updated?: string;
  excerpt: string;
  featured?: boolean;
  tags?: string[];
  readingMinutes?: number;
  author: BlogAuthor;
  thumb: { illust: Illust; tint?: Tint };
  seo?: BlogSeo;
};

/** A fully-resolved post: validated frontmatter + body + derived fields. */
export type BlogPost = BlogFrontmatter & {
  /** Locale-less href path, e.g. /blog/ai/geo-benchmark. */
  href: string;
  /** Raw MDX body (frontmatter stripped). */
  body: string;
  /** Minutes to read (from frontmatter or computed). */
  readingMinutes: number;
  /** Resolved thumbnail tint (falls back to the category tint). */
  tint: Tint;
};
