import { LocalizedHtmlContent, LocalizedTextContent } from '../../../shared/models/config';

export interface ContentPageSeoConfig {
  title?: string;
  description?: string;
  keywords?: string;
  canonical?: string;
  ogTitle?: string;
  ogDescription?: string;
  ogImage?: string;
  robots?: string;
}

export interface ContentPageTranslation {
  title?: string;
  html?: string;
  seo?: ContentPageSeoConfig;
}

export type ContentPageStatus = 'draft' | 'published';

export interface ContentPage {
  id: string;
  slug: string;
  /** Editable independently of `slug`; defaults from it but may diverge (e.g. legacy redirects). */
  route: string;
  title: string;
  icon?: string;
  order: number;
  showInFooter: boolean;
  showInHeader: boolean;
  showInSitemap: boolean;
  visibility: {
    desktop?: boolean;
    tablet?: boolean;
    mobile?: boolean;
  };
  requiresAuthentication: boolean;
  footerGroup?: string;
  translations: Record<string, ContentPageTranslation>;
  seo?: ContentPageSeoConfig;
  /** Master on/off switch; a disabled page never resolves on the storefront. */
  enabled: boolean;
  /** Per-page publish lifecycle, independent of the whole-bootstrap draft/publish cycle. */
  status: ContentPageStatus;
  customTemplate?: string;
  heroImage?: string;
  heroImageAlt?: string;
  heroImageCaption?: string;
  thumbnail?: string;
  gallery?: string[];
  /** ISO timestamp set whenever this page is persisted; drives the CMS dashboard's "last edited" and health metrics. */
  updatedAt?: string;
}

export interface ContentPageBootstrapInput {
  id: string;
  slug: string;
  route?: string;
  title?: string | LocalizedTextContent;
  showInFooter?: boolean;
  showInHeader?: boolean;
  showInSitemap?: boolean;
  icon?: string;
  order?: number;
  visibility?: {
    desktop?: boolean;
    tablet?: boolean;
    mobile?: boolean;
  };
  requiresAuthentication?: boolean;
  footerGroup?: string;
  translations?: Record<string, ContentPageTranslation>;
  html?: string | LocalizedHtmlContent;
  seo?: ContentPageSeoConfig | { title?: string | LocalizedTextContent; description?: string | LocalizedTextContent; keywords?: string; canonical?: string; ogTitle?: string | LocalizedTextContent; ogDescription?: string | LocalizedTextContent; ogImage?: string; robots?: string; metaTags?: Array<{ name?: string; property?: string; content: string }>; };
  enabled?: boolean;
  status?: ContentPageStatus;
  customTemplate?: string;
  heroImage?: string;
  heroImageAlt?: string;
  heroImageCaption?: string;
  thumbnail?: string;
  gallery?: string[];
  updatedAt?: string;
}
