/**
 * Public barrel for every DisplayCard type.
 *
 * Each card exports four artifacts:
 *   - `<Name>Card` interface (the JSON shape)
 *   - `<Name>CardDefaults` const
 *   - `<Name>CardMetadata` const
 *   - `<Name>CardEditConfig` const (the FormBuilder inspector schema)
 *
 * The `DisplayCard` union below is the JSON shape of any card. The
 * engine's `CardRenderer` accepts a `DisplayCard` and uses `cardType`
 * to resolve the renderer component.
 */

export type { CardListCard } from "./CardListCard"
export {
  CardListCardDefaults,
  CardListCardEditConfig,
  CardListCardMetadata,
  TabContainerCardListCardEditConfig,
} from "./CardListCard"

export type {
  AdvancedSearchField,
  DataTableCard,
  DataTableColumn,
  DataTableOptions,
  ExportConfig,
  FilterField,
  TableAction,
  TableColumnType,
} from "./DataTableCard"
export {
  DataTableCardDefaults,
  DataTableCardEditConfig,
  DataTableCardMetadata,
} from "./DataTableCard"

export type { ElementDisplayCard } from "./ElementDisplayCard"
export {
  ElementDisplayCardDefaults,
  ElementDisplayCardEditConfig,
  ElementDisplayCardMetadata,
} from "./ElementDisplayCard"

export type { ElementListCard } from "./ElementListCard"
export {
  ElementListCardDefaults,
  ElementListCardEditConfig,
  ElementListCardMetadata,
  TabContainerElementListCardEditConfig,
} from "./ElementListCard"

export type {
  GridBreakpoint,
  GridItem,
  GridLayout,
  GridViewCard,
} from "./GridViewCard"
export {
  GridViewCardDefaults,
  GridViewCardEditConfig,
  GridViewCardMetadata,
} from "./GridViewCard"

export type { InfoCard, InfoCardField } from "./InfoCard"
export {
  InfoCardDefaults,
  InfoCardEditConfig,
  InfoCardMetadata,
} from "./InfoCard"

export type { TabListCard, TabListCardStyle } from "./TabListCard"
export {
  TabListCardDefaults,
  TabListCardEditConfig,
  TabListCardMetadata,
} from "./TabListCard"

import type { CardListCard } from "./CardListCard"
import type { DataTableCard } from "./DataTableCard"
import type { ElementDisplayCard } from "./ElementDisplayCard"
import type { ElementListCard } from "./ElementListCard"
import type { GridViewCard } from "./GridViewCard"
import type { InfoCard } from "./InfoCard"
import type { TabListCard } from "./TabListCard"

import { CardListCardMetadata } from "./CardListCard"
import { DataTableCardMetadata } from "./DataTableCard"
import { ElementDisplayCardMetadata } from "./ElementDisplayCard"
import { ElementListCardMetadata } from "./ElementListCard"
import { GridViewCardMetadata } from "./GridViewCard"
import { InfoCardMetadata } from "./InfoCard"
import { TabListCardMetadata } from "./TabListCard"

/**
 * The discriminated-union JSON shape of any DisplayCard. Narrowing on
 * `cardType` gives full intellisense for the card-specific fields.
 */
export type DisplayCard =
  | CardListCard
  | DataTableCard
  | ElementDisplayCard
  | ElementListCard
  | GridViewCard
  | InfoCard
  | TabListCard

/**
 * Runtime registry of card metadata keyed by `cardType`. Used by the
 * FormBuilder palette to enumerate available cards.
 */
export const DisplayCardMetadataMap = {
  "card-list": CardListCardMetadata,
  datatable: DataTableCardMetadata,
  "element-display": ElementDisplayCardMetadata,
  "element-list": ElementListCardMetadata,
  "grid-view": GridViewCardMetadata,
  "info-card": InfoCardMetadata,
  "tab-list": TabListCardMetadata,
} as const
