/// <reference types="dcl" />
/// <reference types="env" />

import { UserData } from '@decentraland/Identity';

/**
 * ComponentObjectPairs is a type that is used to store the pairing of a component to an object.
 */
declare interface ComponentObjectPairs {
    component: string;
    object: any;
}

/**
 * Debug message displays a UI prompt with a message and a button to close it.
 *
 * @param message - The message to be displayed in the UI prompt
 * @public
 */
export declare function debugMessage(message: string): void;

/**
 * TODO: Need to convert VideoScreen class to a MediaEntity to handle different types of media, not just videoScreen
 * TODO: Types of media: video, images
 * TODO: Detect if media is a video or image
 * TODO: Media Controls: Play/Pause, Mute/Unmute, Volume, Fullscreen, Close
 */
/**
 * DynamicMedia will automatically detect whether the media is a video or image and will handle the media accordingly
 *
 * @param media - Texture | VideoClip - URL of the media to be displayed
 * @param shape - The shape of the media to be displayed
 * @param transform - The position, rotation, and scale of the media to be displayed
 * @param name - The name of the Entity, mainly used for debugging
 * @returns Entity
 * @public
 */
export declare class DynamicMedia extends Entity {
    material: Material;
    shape: Shape;
    texture?: Texture | VideoTexture;
    video?: VideoClip;
    private mediaType?;
    constructor(media: Texture | VideoClip, shape: Shape, transform: TransformConstructorArgs, name?: string);
    initialize(): void;
    updateMedia(media: Texture | VideoClip): void;
    addPausePlayVideo(mediaType: "video" | "image"): void;
    addUIPanel(info: infoData, image: Texture, imageSize: {
        Width: number;
        Height: number;
    }): void;
}

/**
 * EnableDisable is a class that holds a boolean value that can be used to enable or disable a component.
 *
 * @param bEnable - The boolean value to be used to enable or disable a component, true by default.
 * @public
 */
export declare class EnableDisable {
    bEnable: boolean;
    constructor(bEnable?: boolean);
}

/**
 * @public
 * @param title - The title to be displayed in the UI
 * @param owner - The owner, if there is an owner of the image / video
 * @param description - The description of the object this will be displayed in the UI
 * @param link - The link URL that will be opened when the link button is clicked
 * @param linkText - The text for the link button
 */
declare type infoData = {
    title: string;
    description: string;
    owner?: string;
    link?: string;
    linkText?: string;
};

/**
 * setBoxUVs is a function that allows you to set the UVs of a BoxShape, works with Atlas textures.
 *
 * @param rows - The number of rows in the grid or Atlas texture
 * @param cols - The number of columns in the grid or Atlas texture
 * @returns - Returns an array of Vector2s that represent the UVs for a grid of rows and columns
 * @public
 */
export declare function setBoxUVs(rows: number, cols: number): number[];

/**
 * setCustomUVs is a function that allows you to set the UVs of a shape to a custom UV space with offsets.
 *
 * @param rows - The number of rows in the grid
 * @param cols - The number of columns in the grid
 * @param offsetX - The offset the UVs in the X axis or the U axis
 * @param offsetY - The offset the UVs in the Y axis or the V axis
 * @returns - Returns an array of Vector2s that represent the UVs for a grid of rows and columns
 * @public
 */
export declare function setCustomUVs(rows: number, cols: number, offsetX?: number, offsetY?: number): number[];

/**
 * setTimeout is a function that allows you to delay the execution of a function, then removes the entity from the scene.
 *
 * @param delay - The delay in milliseconds
 * @param callback - The callback function to be called after the delay is finished
 * @public
 */
export declare function setTimeout(delay: number, callback: () => void): void;

/**
 * setUVsBasic is a function that allows you to set the UVs of a shape to a basic 0-1 UV space.
 *
 * @param rows - The number of rows in the grid
 * @param cols - The number of columns in the grid
 * @returns - Returns an array of Vector2s that represent the UVs for a grid of rows and columns
 * @public
 */
export declare function setUVsBasic(rows: number, cols: number): number[];

/**
 * The Swivel Meta Config type, used to store the meta data for the Swivel Config.
 */
declare type SwivelMetaConfig = {
    [key: string]: any;
};

/**
 * Swivel Meta Services, a class used to interact with Swivel Meta API.
 * Allows you to fetch data from Swivel Meta API, update components, and send user data to Swivel Meta Cloud for analytics.
 *
 * @param projectId - The project ID to fetch data from Swivel Meta API.
 * @param debug - Enable/Disable debug mode.
 * @param bInitializeDiscord - Enable/Disable discord callback.
 * @param bLoadOnEnter - Enable/Disable loading components when a user enters the scene.
 * @public
 */
export declare class SwivelMetaServices extends Entity {
    private apiURL;
    projectId: string;
    startTime: Date;
    endTime?: Date;
    debug: boolean;
    private discordHookURL;
    userData: UserData;
    sceneName?: string;
    display_name?: string;
    wallet_address?: string;
    room_id?: string;
    guest?: boolean;
    platform?: string;
    realm?: string;
    parcels?: string;
    bInitializeDiscord: boolean;
    bLoadOnEnter: boolean;
    componentObjectPairs: ComponentObjectPairs[];
    once: boolean;
    constructor(projectId: string, debug?: boolean, bInitializeDiscord?: boolean, bLoadOnEnter?: boolean);
    /**
     * Initialize Swivel Meta SDK. This function will get the discordHookUrl from Swivel Meta API
     * then add a listener to the scene which will ping your discord and send the user details to Swivel Meta Cloud
     *
     * @param projectId - The project ID to fetch the configuration for.
     */
    private InitializeSwivelMetaServices;
    /**
     * Add a listener to the scene which will ping your discord and send the user details to Swivel Meta Cloud.
     *
     * @public
     */
    InitializeVisitorData(): Promise<void>;
    /**
     * Get the Discord Hook URL from Swivel Meta API.
     *
     * @param projectName - The project ID to pull the Discord Callback Url for.
     * @returns Promise<string> - The Discord Hook URL.
     */
    private getDiscordCallbackUrl;
    /**
     * Creates a new fetch request to the Swivel Meta API. Used to query the API for data.
     *
     * @param request - The request object to send to the API.
     * @returns - The payload for the request.
     */
    private fetchQuery;
    /** Use Decentraland built in fetch function to fetch data from the Swivel API.
     * Url: https://prod-swivelmeta.com/core2/query
     * Method: POST
     * Allow Headers: Accept, Origin
     * Origin: https://play.decentraland.org
     */
    /**
     * Send a request to the Swivel Meta Analytics to store the visitor data.
     *
     * @param postBody - The body of the request to send to the Swivel Meta API.
     */
    private submitFetch;
    /**
     * Send a notification to the Discord webhook.
     *
     * @param requestData - The data to send to the Discord webhook.
     */
    private sendDiscordNotification;
    /**
     * Send discord notification of the amount of MANA being transferred and the wallet address receiving the MANA.
     *
     * @param amount - The amount of MANA to transferred.
     * @param address - The wallet address receiving the MANA.
     */
    private transferringTipNotificationDiscord;
    /**
     * Send discord notification of successfully transaction completion
     *
     * @param address - The wallet address that received the MANA.
     */
    private transferTipCompletionNotificationDiscord;
    /**
     * Send a general notification to the Discord webhook. This is used for sending miscellaneous notifications.
     *
     * @param message - The message to send to the Discord webhook.
     */
    private generalNotificationDiscord;
    /**
     * Get the current date and time in UTC epoch time format.
     *
     * @returns - The current date and time in UTC epoch time format.
     */
    getCurrentUtcEpochTime(): string;
    /**
     * Send a notification to the Discord webhook with the user's details and the action/activity they performed.
     *
     * @param operationType - The operation type to send to the Discord webhook. This could be 'entered' or 'left' the scene or claiming a POAP.
     * @param userId - The user ID to send to the Discord webhook.
     */
    sendUserDetailsNotification(operationType: any, userId: any): Promise<void>;
    /**
     * Add the listener for the user's activities. Like when the user enters the scene or leaves the scene.
     *
     * @public
     */
    addUserActivitiesListener(): void;
    /**
     * Get scene and user details to assemble into a visitor data object. Used for sending visitor data to Swivel Meta Analytics.
     *
     * @returns VisitorData - The data object that contains all the visitor data that is collected.
     */
    private getVisitorDataBody;
    /**
     * Assembles visitor data to be sent to Swivel Meta Analytics Service.
     *
     * @param visitor - Data of the user and scene details.
     * @returns - Stringified visitor data.
     *
     */
    private assembleVisitorData;
    /**
     * Fetches the config data from the Swivel Meta API.
     * @param projectId - The project ID to fetch the config for.
     * @returns - The config data in JSON format.
     */
    private getConfigData;
    /**
     * Get the Swivel Meta Config Data from the Swivel Meta API.
     *
     * @returns - Swivel Meta Config Data
     * @throws - Error if the config data is undefined.
     *
     * @public
     */
    parseConfigData(): Promise<SwivelMetaConfig>;
    /**
     * This function is used to update the media when the scene load.
     *
     * @param assign - The pairing of, components to be assigned to the entities.
     * @param debug - Debug mode, default is false.
     *
     * @example //Usage example
     * const componentEntityPairs = [ { component: "mainVideoScreen", object: videoScreen }, { component: "ExampleComponent2", object: ExampleDynamicMedia2 } ];
     * updateMediaOnSceneLoad( componentEntityPairs );
     *
     * @public
     */
    updateMediaOnSceneLoad(assign: {
        component: string;
        object: any;
    }[], debug?: boolean): Promise<void>;
    /**
     * Update the DynamicMedia when a user enters the parcel.
     *
     * @param assign - The pairing of, components to be assigned to the entities.
     *
     * @example //Usage example
     * const componentEntityPairs = [
     *  { component: "mainVideoScreen", object: videoScreen }
     *  { component: "ExampleComponent2", object: ExampleDynamicMedia2 }
     * ];
     * updateMediaOnSceneEnter( componentEntityPairs );
     *
     * @public
     */
    updateMediaOnSceneEnter(assign: {
        component: string;
        object: any;
    }[]): Promise<void>;
    /**
     * A function to log debug messages. Only logs if the debug flag is set to true.
     */
    private debugLog;
}

export { }
