// Single registry for all /guides/* articles. The guides index, sitemap and
// RSS feed all render from this list, so adding an article here is the only
// bookkeeping step a new guide page needs besides its own directory.

export interface Article {
  slug: string;
  title: string;
  description: string;
  /** Short badge shown on the index card, e.g. "Guide", "Comparison". */
  tag: string;
  /** ISO date the article first shipped. */
  datePublished: string;
  /** ISO date of last substantive edit. Defaults to datePublished. */
  dateModified?: string;
}

export const ARTICLES: Article[] = [
  {
    slug: 'host-mcp-server-with-oauth',
    title: 'How to host a remote MCP server with OAuth (2026)',
    description:
      'Streamable HTTP, OAuth 2.1, PKCE and Resource Indicators — what it actually takes to put a remote MCP server in production, and the shortcuts.',
    tag: 'Guide',
    datePublished: '2026-05-31',
  },
  {
    slug: 'hosted-mcp-platforms-compared',
    title: 'Hosted MCP platforms compared: Cloudflare, Smithery, Composio & generating your own',
    description:
      'The MCP hosting landscape splits into four categories. Which one fits depends on whether you have a server already, need a catalog, or need bespoke logic.',
    tag: 'Comparison',
    datePublished: '2026-05-31',
  },
  {
    slug: 'mintmcp-alternative',
    title: 'MintMCP alternative: generate and host a custom MCP server',
    description:
      'MintMCP wraps an existing STDIO server into a remote one. If you do not have a server yet, here is the generate-from-a-prompt route — and where MintMCP still wins.',
    tag: 'Alternative',
    datePublished: '2026-05-31',
  },
];

export function articleBySlug(slug: string): Article | undefined {
  return ARTICLES.find((a) => a.slug === slug);
}

/** Articles newest-first, for the index page and the RSS feed. */
export function articlesNewestFirst(): Article[] {
  return [...ARTICLES].sort((a, b) =>
    (b.dateModified ?? b.datePublished).localeCompare(a.dateModified ?? a.datePublished),
  );
}
