import type { CollectionEntry } from 'astro:content';

/** Registered Content Type identifiers **/
export type ContentType = 'article' | 'page' | 'element' | 'section';

/**
 * Minimal common shape for everything that participates in path resoltution and parent chain walking.
 * Normalizes the slug/id and parent differences across collections
 **/

export interface Resolvable {
  slug: string;
  title: string;
  parent: string | null;
}

/** Collection name -> normalized entries **/
export type CollectionPool = Record<string, Resolvable[]>;

/** Fully resolved content entry with computed path **/
export interface ResolvedEntry {
  type: ContentType;
  path: string;
  entry:
    | CollectionEntry<'pages'>
    | CollectionEntry<'articles'>
    | CollectionEntry<'elements'>;
}

/** Single segment in a breadcrumb trail **/
export interface BreadcrumbSegment {
  label: string;
  href: string;
}

/** Entry in the command palette search index **/
export interface PaletteEntry {
  label: string;
  path: string;
  type: ContentType;
  parent: string | null;
  depth: number;
}

/** Sidenote */

export interface Sidenote {
  id: string;
  title: string;
  marker: string;
  type: string;
  content: string;
}
