/// <reference path="../.astro/types.d.ts" />

declare global {
  interface Window {
    themeUtils: {
      initTheme: () => void;
      toggleTheme: () => void;
      getStoredTheme: () => string;
    };
    toolsData: any[];
    showToolDetails: (toolName: string, modalType?: string) => void;
    hideToolDetails: (modalType?: string) => void;
    hideAllToolDetails: () => void;
    toggleKbEntry: (entryId: string) => void;
    toggleDomainAgnosticSection: (sectionId: string) => void;
    restoreAIResults?: () => void;
    switchToAIView?: () => void;
    clearTagFilters?: () => void;
    clearAllFilters?: () => void;
    
    createToolSlug: (toolName: string) => string;
    findToolByIdentifier: (tools: any[], identifier: string) => any | undefined;
    isToolHosted: (tool: any) => boolean;

    checkClientAuth: (context?: string) => Promise<{authenticated: boolean; authRequired: boolean; expires?: string}>;
    requireClientAuth: (callback?: () => void, returnUrl?: string, context?: string) => Promise<boolean>;
    showIfAuthenticated: (selector: string, context?: string) => Promise<void>;
    setupAuthButtons: (selector?: string) => void;

    scrollToElement: (element: Element | null, options?: ScrollIntoViewOptions) => void;
    scrollToElementById: (elementId: string, options?: ScrollIntoViewOptions) => void;
    scrollToElementBySelector: (selector: string, options?: ScrollIntoViewOptions) => void;

    applyScenarioSearch?: (scenarioId: string) => void;
    selectPhase?: (phase: string) => void;
    selectApproach?: (approach: string) => void;
    navigateToGrid?: (toolName: string) => void;
    navigateToMatrix?: (toolName: string) => void;
    toggleAllScenarios?: () => void;
    showShareDialog?: (shareButton: Element) => void;
    modalHideInProgress?: boolean;
    
    shareArticle: (button: HTMLElement, url: string, title: string) => Promise<void>;
    shareCurrentArticle: (button: HTMLElement) => Promise<void>;
  }
}

declare module 'js-yaml' {
  export function load(str: string): any;
}

export {};