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

export const WizardRootPropsSchema = z.object({
  step: z.number().optional().describe("Controlled current step index (0-based)"),
  defaultStep: z.number().optional().describe("Initial step (uncontrolled). Defaults to 0"),
  linear: z.boolean().optional().describe("Whether steps must be completed in order. Defaults to true"),
  orientation: z.enum(["horizontal", "vertical"]).optional().describe("Step indicator layout. Defaults to 'horizontal'"),
});

export interface WizardRootProps extends z.infer<typeof WizardRootPropsSchema> {
  onStepChange?: (step: number) => void;
  onComplete?: () => void;
  children: JSX.Element;
}

export const WizardStepPropsSchema = z.object({
  index: z.number().describe("Step index (0-based)"),
  disabled: z.boolean().optional().describe("Whether this step is disabled"),
  completed: z.boolean().optional().describe("Whether this step is completed"),
});

export interface WizardStepProps extends z.infer<typeof WizardStepPropsSchema> { children: JSX.Element; }
export interface WizardStepListProps extends JSX.HTMLAttributes<HTMLDivElement> { children: JSX.Element; }
export interface WizardStepTriggerProps extends JSX.ButtonHTMLAttributes<HTMLButtonElement> { children?: JSX.Element; }
export interface WizardStepContentProps extends JSX.HTMLAttributes<HTMLDivElement> { children?: JSX.Element; }
export interface WizardPrevProps extends JSX.ButtonHTMLAttributes<HTMLButtonElement> { children?: JSX.Element; }
export interface WizardNextProps extends JSX.ButtonHTMLAttributes<HTMLButtonElement> { children?: JSX.Element; }

export const WizardMeta: ComponentMeta = {
  name: "Wizard",
  description: "Multi-step flow with step indicators, navigation, and linear/non-linear progression",
  parts: ["Root", "StepList", "Step", "StepTrigger", "StepContent", "PrevButton", "NextButton"] as const,
  requiredParts: ["Root", "Step", "StepContent"] as const,
} as const;
