/**
 *
 * @module loading
 *
 */
import type { DefineComponent, DesignToken, EmitFn, PassThrough } from '@digivue/core';
import type { ComponentHooks } from '@digivue/core/basecomponent';
import type { PassThroughOptions } from 'digivue/passthrough';
import { VNode } from 'vue';

export declare type LoadingPassThroughOptionType = LoadingPassThroughAttributes | ((options: LoadingPassThroughMethodOptions) => LoadingPassThroughAttributes | string) | string | null | undefined;

/**
 * Custom passthrough(pt) option method.
 */
export interface LoadingPassThroughMethodOptions {
    /**
     * Defines instance.
     */
    instance: any;
    /**
     * Defines valid properties.
     */
    props: LoadingProps;
    /**
     * Defines current inline state.
     */
    state: LoadingState;
    /**
     * Defines valid attributes.
     */
    attrs: any;
    /**
     * Defines parent options.
     */
    parent: any;
    /**
     * Defines passthrough(pt) options in global config.
     */
    global: object | undefined;
}

/**
 * Custom passthrough(pt) options.
 * @see {@link LoadingProps.pt}
 */
export interface LoadingPassThroughOptions {
    /**
     * Used to pass attributes to the root's DOM element.
     */
    root?: LoadingPassThroughOptionType;
    /**
     * Used to pass attributes to the mask's DOM element.
     */
    mask?: LoadingPassThroughOptionType;
    /**
     * Used to manage all lifecycle hooks.
     * @see {@link BaseComponent.ComponentHooks}
     */
    hooks?: ComponentHooks;
}

/**
 * Custom passthrough attributes for each DOM elements
 */
export interface LoadingPassThroughAttributes {
    [key: string]: any;
}

/**
 * Defines current inline state in Loading component.
 */
export interface LoadingState {
    /**
     * Current blocked state as a boolean.
     * @defaultValue false
     */
    isBlocked: boolean;
}

/**
 * Defines valid properties in Loading component
 */
export interface LoadingProps {
    /**
     * Controls the blocked state.
     * @defaultValue false
     */
    blocked?: boolean | undefined;
    /**
     * When enabled, the whole document gets blocked.
     * @defaultValue false
     */
    fullScreen?: boolean | undefined;
    /**
     * Base zIndex value to use in layering.
     * @defaultValue 0
     */
    baseZIndex?: number | undefined;
    /**
     * Whether to automatically manage layering.
     * @defaultValue true
     */
    autoZIndex?: boolean | undefined;
    /**
     * It generates scoped CSS variables using design tokens for the component.
     */
    dt?: DesignToken<any>;
    /**
     * Used to pass attributes to DOM elements inside the component.
     * @type {LoadingPassThroughOptions}
     */
    pt?: PassThrough<LoadingPassThroughOptions>;
    /**
     * Used to configure passthrough(pt) options of the component.
     * @type {PassThroughOptions}
     */
    ptOptions?: PassThroughOptions;
    /**
     * When enabled, it removes component related styles in the core.
     * @defaultValue false
     */
    unstyled?: boolean;
}

/**
 * Defines valid slots in Loading component
 */
export interface LoadingSlots {
    /**
     * Custom content's slot.
     */
    default(): VNode[];
}

/**
 * Defines valid emits in Loading component
 */
export interface LoadingEmitsOptions {
    /**
     * Fired when the element gets blocked.
     */
    block(): void;
    /**
     * Fired when the element gets unblocked.
     */
    unblock(): void;
}

export declare type LoadingEmits = EmitFn<LoadingEmitsOptions>;

/**
 *
 * @group Component
 *
 */
declare const Loading: DefineComponent<LoadingProps, LoadingSlots, LoadingEmits>;

declare module 'vue' {
    export interface GlobalComponents {
        Loading: DefineComponent<LoadingProps, LoadingSlots, LoadingEmits>;
    }
}

export default Loading;
