import { z } from "zod/v4";
import type { JSX } from "solid-js";
import type { ComponentMeta } from "../../meta";

export const PaginationRootPropsSchema = z.object({
  page: z.number().optional().describe("Current page number (1-based)"),
  defaultPage: z.number().optional().describe("Initial page number (uncontrolled)"),
  count: z.number().describe("Total number of pages"),
  siblingCount: z.number().optional().describe("Number of sibling pages shown around the current page. Defaults to 1"),
  disabled: z.boolean().optional().describe("Whether the pagination controls are disabled"),
});

export interface PaginationRootProps extends z.infer<typeof PaginationRootPropsSchema>, JSX.HTMLAttributes<HTMLElement> {
  onPageChange?: (page: number) => void;
  children?: JSX.Element;
}

export const PaginationMeta: ComponentMeta = {
  name: "Pagination",
  description: "Navigation for paginated content with page numbers, previous/next controls",
  parts: ["Root", "Previous", "Next", "Items", "Item", "Ellipsis"] as const,
  requiredParts: ["Root"] as const,
} as const;
