import { IAddedProduct, IAddProductOptions, RefreshScopeEnum } from '@webpack/js-shop/Interfaces';
import type { ResultOf } from '@graphql-typed-document-node/core';
import type { GET_RECOMMENDER } from '@assets/js-shop/query';
import { ToastEventPayload } from '@assets/js-shop/events';
import PhotoSwipeLightbox from 'photoswipe/lightbox';

declare global {
   interface JsShop {
      translations?: {};
      config: { // (dynamic config) deprecated, use jsShopContext instead!!!
         imageType: number;
         moduleCartBox?: boolean;
         moduleToasts?: boolean;
         toastProductName?: boolean;
         moduleMobileAddedToCart?: boolean;
      };
      addToast(message: string): void
      refresh(scope?: RefreshScopeEnum): void;
      ignoreRefreshCookie(): void; // tells JsShop to not refresh even when refresh cookie is set
      clearCache(): void;
      events: {
         push(callback: (() => void)): void;
         unshift(callback: (() => void)): void;
         getAll(): (()=> void)[];
      };
      lastVisitedProducts: {
         add(id: number): void;
         get(excludeId: number): number[];
      }
      addProductToCart(item: IAddedProduct, offset: number, options: IAddProductOptions ): Promise<any>;
      addProductsToCart(item: IAddedProduct[], offsets: number[], options: IAddProductOptions): Promise<any>;
      loadRecommendersProducts(element: Element): Promise<any>;
      getActiveSeller(): Promise<any>;
   }
   interface Wpj {
      onReady: (() => void)[];
      mobilemenu: any;
      jsShop: JsShop;
      storage: {
         cookies: {
            setItem(sKey: string, sValue: string | number, vEnd?: string | number | Date, sPath?: string, sDomain?: string): void;
            getItem(sKey: string): string;
            hasItem(sKey: string): string;
            removeItem(sKey: string, sPath?: string, sDomain?: string): string;
         };
      };
      tracking: {
         callPush(data:object):void;
         handleImpressions():void;
      },
      cookie_bar_send: boolean;
      getCookie(name: string): string | null;
      smartform: {};
      graphqlRoute: string;
      domUtils: {
         reloadPartsFromUrl(url: string, $oldParts: unknown, data: string | null, finishedCallback?: () => void):void;
      };
   }

   const COMPONENTS: any;
   const wpj: Wpj;
   const MODULES: {[key: string]: boolean};

   interface Window {
      wpj: Wpj;
      Sentry?: any; // Is set only for non-component shops, which use CDN sentry
      dataLayer: object[];
      wpjBasePath?: string;
      gtag(s1: string, s2: string, s3: object): any;
      wpjLightbox: PhotoSwipeLightbox;
   }
}

export {};
