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

export const NavigationMenuRootPropsSchema = z.object({
  value: z.string().optional().describe("Controlled active item value (the currently open dropdown)"),
  defaultValue: z.string().optional().describe("Initial active item (uncontrolled)"),
  orientation: z.enum(["horizontal", "vertical"]).optional().describe("Menu orientation. Defaults to 'horizontal'"),
  delayDuration: z.number().optional().describe("Delay in ms before dropdown opens on hover. Defaults to 200"),
});

export interface NavigationMenuRootProps extends z.infer<typeof NavigationMenuRootPropsSchema>, Omit<JSX.HTMLAttributes<HTMLElement>, keyof z.infer<typeof NavigationMenuRootPropsSchema>> {
  onValueChange?: (value: string) => void;
  children: JSX.Element;
}
export interface NavigationMenuListProps extends JSX.HTMLAttributes<HTMLUListElement> { children: JSX.Element; }
export interface NavigationMenuItemProps extends JSX.HTMLAttributes<HTMLLIElement> { value?: string; children: JSX.Element; }
export interface NavigationMenuTriggerProps extends JSX.ButtonHTMLAttributes<HTMLButtonElement> { children?: JSX.Element; }
export interface NavigationMenuContentProps extends JSX.HTMLAttributes<HTMLDivElement> { forceMount?: boolean; children?: JSX.Element; }
export interface NavigationMenuLinkProps extends JSX.AnchorHTMLAttributes<HTMLAnchorElement> { active?: boolean; children?: JSX.Element; }
export interface NavigationMenuViewportProps extends JSX.HTMLAttributes<HTMLDivElement> { forceMount?: boolean; }

export const NavigationMenuMeta: ComponentMeta = {
  name: "NavigationMenu",
  description: "Horizontal navigation bar with dropdown submenus, hover intent, and keyboard support",
  parts: ["Root", "List", "Item", "Trigger", "Content", "Link", "Viewport", "Indicator"] as const,
  requiredParts: ["Root", "List", "Item"] as const,
} as const;
