import type { Metadata } from 'next';

const BASE_URL = 'https://banatie.app';

export const SEO_DEFAULTS = {
  siteName: 'Banatie',
  locale: 'en_US',
  author: 'Banatie',
  ogImage: {
    url: `${BASE_URL}/og-image.png`,
    width: 1200,
    height: 630,
    alt: 'Banatie - AI Image Generation API for Developers',
  },
};

export type DocsPageSeo = {
  path: string;
  title: string;
  description: string;
  keywords: string[];
};

export const createDocsMetadata = (page: DocsPageSeo): Metadata => {
  const url = `${BASE_URL}${page.path}`;

  return {
    title: page.title,
    description: page.description,
    authors: [{ name: SEO_DEFAULTS.author }],
    keywords: page.keywords,
    robots: 'index, follow',
    alternates: {
      canonical: url,
      languages: { en: url, 'x-default': url },
    },
    openGraph: {
      title: page.title,
      description: page.description,
      url,
      siteName: SEO_DEFAULTS.siteName,
      locale: SEO_DEFAULTS.locale,
      type: 'article',
      images: [SEO_DEFAULTS.ogImage],
    },
    twitter: {
      card: 'summary_large_image',
      title: page.title,
      description: page.description,
    },
  };
};

export const DOCS_PAGES = {
  'getting-started': {
    path: '/docs/',
    title: 'Getting Started with Banatie API | AI Image Generation',
    description:
      'Generate your first AI image in a few simple steps. REST API for production-ready image assets via CDN.',
    keywords: ['banatie api', 'image generation api', 'ai image api tutorial', 'getting started', 'api quickstart'],
  },
  generation: {
    path: '/docs/generation/',
    title: 'Image Generation Guide | Banatie API Docs',
    description:
      'Generate AI images from text prompts. Aspect ratios, prompt templates, reference images, and generation chaining.',
    keywords: ['image generation', 'text to image api', 'ai image prompt', 'aspect ratio', 'reference images'],
  },
  images: {
    path: '/docs/images/',
    title: 'Working with Images | Banatie API Docs',
    description:
      'Upload, manage, and organize images. CDN delivery, aliases for easy reference, and image management via API.',
    keywords: ['image upload api', 'cdn image delivery', 'image aliases', 'image management', 'organize images'],
  },
  'live-urls': {
    path: '/docs/live-urls/',
    title: 'Live URLs — AI Placeholder Images & Dynamic Generation | Banatie',
    description:
      'Generate AI placeholder images directly from URL. No API calls — use in img tags. Perfect for prototypes, mockups, and dynamic content.',
    keywords: [
      'placeholder images',
      'placeholder image url',
      'ai placeholder generator',
      'live url image generation',
      'dynamic image generation',
      'image placeholder api',
      'placeholder image api',
    ],
  },
  authentication: {
    path: '/docs/authentication/',
    title: 'Authentication | Banatie API Docs',
    description: 'How to authenticate with Banatie API using API keys. Get your key and start generating images.',
    keywords: ['api authentication', 'api key', 'banatie api key', 'x-api-key header'],
  },
  'api-overview': {
    path: '/docs/api/',
    title: 'API Reference | Banatie Docs',
    description: 'Complete REST API reference for Banatie. All endpoints, parameters, response formats, and error codes.',
    keywords: ['banatie api reference', 'rest api documentation', 'api endpoints', 'image generation api docs'],
  },
  'api-generations': {
    path: '/docs/api/generations/',
    title: 'Generations API | Banatie API Reference',
    description: 'Create, list, update, and delete AI image generations. Full endpoint documentation with examples.',
    keywords: ['generations api', 'create generation', 'image generation endpoint', 'regenerate image api'],
  },
  'api-images': {
    path: '/docs/api/images/',
    title: 'Images API | Banatie API Reference',
    description: 'Upload, list, update, and delete images. Manage aliases and access images via CDN.',
    keywords: ['images api', 'upload image api', 'image cdn api', 'image alias api'],
  },
  'api-flows': {
    path: '/docs/api/flows/',
    title: 'Flows API | Banatie API Reference',
    description: 'Manage generation flows. List, update, and delete flows that group related generations together.',
    keywords: ['flows api', 'generation flow', 'chain generations', 'flow management api'],
  },
  'api-live-scopes': {
    path: '/docs/api/live-scopes/',
    title: 'Live Scopes API | Banatie API Reference',
    description: 'Manage live URL scopes. Create, configure, and control live image generation endpoints.',
    keywords: ['live scopes api', 'live url management', 'scope limits', 'live generation api'],
  },
  'guides': {
    path: '/docs/guides/',
    title: 'Guides | Banatie Docs',
    description: 'Step-by-step guides for common use cases. Placeholder images, prototyping, and more.',
    keywords: ['banatie guides', 'image generation tutorials', 'api guides'],
  },
  'guide-placeholder-images': {
    path: '/docs/guides/placeholder-images/',
    title: 'AI Placeholder Image Generator — Light & Dark Mode | Banatie',
    description:
      'Generate AI placeholder images for development. Image placeholder dark mode, light backgrounds, avatars, products, heroes. Copy-paste HTML examples.',
    keywords: [
      'placeholder image generator',
      'image placeholder dark',
      'placeholder image url',
      'html placeholder image',
      'ai placeholder images',
      'dark mode placeholder',
      'light mode placeholder',
      'profile placeholder image',
      'dummy image generator',
    ],
  },
} as const satisfies Record<string, DocsPageSeo>;
