import type { GridComponent } from "../types/grid";
import { SimpleGrid, simpleGridTemplate } from "./SimpleGrid";
import { ThreeColumnGrid, threeColumnGridTemplate } from "./ThreeColumnGrid";
import { DashboardGrid, dashboardGridTemplate } from "./DashboardGrid";
import {
  SidebarContentGrid,
  sidebarContentGridTemplate,
} from "./SidebarContentGrid";
import {
  CenteredFocusGrid,
  centeredFocusGridTemplate,
} from "./CenteredFocusGrid";

const gridRegistry: Record<string, GridComponent> = {
  simple: {
    template: simpleGridTemplate,
    Component: SimpleGrid,
  },
  threeColumn: {
    template: threeColumnGridTemplate,
    Component: ThreeColumnGrid,
  },
  dashboard: {
    template: dashboardGridTemplate,
    Component: DashboardGrid,
  },
  sidebarContent: {
    template: sidebarContentGridTemplate,
    Component: SidebarContentGrid,
  },
  centeredFocus: {
    template: centeredFocusGridTemplate,
    Component: CenteredFocusGrid,
  },
};

export function getGrid(id: string): GridComponent | undefined {
  return gridRegistry[id];
}

export function getAllGrids(): GridComponent[] {
  return Object.values(gridRegistry);
}
