import type { ReactNode } from "react";
import type { BuilderScreen } from "@/lib/admin/builder/types";
import type { validateBuilderState } from "@/lib/admin/builder/validation";

export type ValidationIssues = ReturnType<typeof validateBuilderState>["issues"];

export interface SectionProps {
  title: string;
  description?: string;
  children: ReactNode;
  defaultExpanded?: boolean;
  alwaysExpanded?: boolean;
}

/**
 * Type guard для проверки что экран является list экраном
 */
export function isListScreen(
  screen: BuilderScreen
): screen is BuilderScreen & {
  list: {
    selectionType: "single" | "multi";
    options: Array<{ id: string; label: string; description?: string; emoji?: string }>;
  };
} {
  return screen.template === "list" && "list" in screen;
}
