/**
 *
 * Icon displays FontAwesome Icons
 *
 * @module Icon
 *
 */
import type { DefineComponent, DesignToken, EmitFn, PassThrough } from '@digivue/core';
import type { ComponentHooks } from '@digivue/core/basecomponent';
import type { PassThroughOptions } from '../passthrough';
import { TransitionProps, VNode } from 'vue';

export declare type IconPassThroughOptionType = IconPassThroughAttributes | ((options: IconPassThroughMethodOptions) => IconPassThroughAttributes | string) | string | null | undefined;

export declare type IconPassThroughTransitionType = TransitionProps | ((options: IconPassThroughMethodOptions) => TransitionProps) | undefined;

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

export interface IconResponsiveOptions {
    /**
     * Breakpoint for responsive mode. Exp; @media screen and (max-width: ${breakpoint}) {...}
     */
    breakpoint: string;
    /**
     * The number of visible items on breakpoint.
     */
    numVisible: number;
}

/**
 * Custom passthrough(pt) options.
 * @see {@link IconProps.pt}
 */
export interface IconPassThroughOptions {
    /**
     * Used to pass attributes to the root's DOM element.
     */
    root?: IconPassThroughOptionType;
    /**
     * Used to pass attributes to the close button's DOM element.
     */
    closeButton?: IconPassThroughOptionType;
    /**
     * Used to pass attributes to the close icon's DOM element.
     */
    closeIcon?: IconPassThroughOptionType;
    /**
     * Used to pass attributes to the header's DOM element.
     */
    header?: IconPassThroughOptionType;
    /**
     * Used to pass attributes to the content's DOM element.
     */
    content?: IconPassThroughOptionType;
    /**
     * Used to pass attributes to the footer's DOM element.
     */
    footer?: IconPassThroughOptionType;
    /**
     * Used to pass attributes to the item container's DOM element.
     */
    itemsContainer?: IconPassThroughOptionType;
    /**
     * Used to pass attributes to the items' DOM element.
     */
    items?: IconPassThroughOptionType;
    /**
     * Used to pass attributes to the previous item button's DOM element.
     */
    previousItemButton?: IconPassThroughOptionType;
    /**
     * Used to pass attributes to the previous item icon's DOM element.
     */
    previousItemIcon?: IconPassThroughOptionType;
    /**
     * Used to pass attributes to the item's DOM element.
     */
    item?: IconPassThroughOptionType;
    /**
     * Used to pass attributes to the next item button's DOM element.
     */
    nextItemButton?: IconPassThroughOptionType;
    /**
     * Used to pass attributes to the next item icon's DOM element.
     */
    nextItemIcon?: IconPassThroughOptionType;
    /**
     * Used to pass attributes to the caption's DOM element.
     */
    caption?: IconPassThroughOptionType;
    /**
     * Used to pass attributes to the indicator list's DOM element.
     */
    indicatorList?: IconPassThroughOptionType;
    /**
     * Used to pass attributes to the indicator's DOM element.
     */
    indicator?: IconPassThroughOptionType;
    /**
     * Used to pass attributes to the indicator button's DOM element.
     */
    indicatorButton?: IconPassThroughOptionType;
    /**
     * Used to pass attributes to the thumbnails' DOM element.
     */
    thumbnails?: IconPassThroughOptionType;
    /**
     * Used to pass attributes to the thumbnail content's DOM element.
     */
    thumbnailContent?: IconPassThroughOptionType;
    /**
     * Used to pass attributes to the previous thumbnail button's DOM element.
     */
    previousThumbnailButton?: IconPassThroughOptionType;
    /**
     * Used to pass attributes to the previous thumbnail icon's DOM element.
     */
    previousThumbnailIcon?: IconPassThroughOptionType;
    /**
     * Used to pass attributes to the thumbnails viewport's DOM element.
     */
    thumbnailsViewport?: IconPassThroughOptionType;
    /**
     * Used to pass attributes to the thumbnail items' DOM element.
     */
    thumbnailItems?: IconPassThroughOptionType;
    /**
     * Used to pass attributes to the thumbnail item's DOM element.
     */
    thumbnailItem?: IconPassThroughOptionType;
    /**
     * Used to pass attributes to the thumbnail's DOM element.
     */
    thumbnail?: IconPassThroughOptionType;
    /**
     * Used to pass attributes to the next thumbnail button's DOM element.
     */
    nextThumbnailButton?: IconPassThroughOptionType;
    /**
     * Used to pass attributes to the next thumbnail icon's DOM element.
     */
    nextThumbnailIcon?: IconPassThroughOptionType;
    /**
     * Used to pass attributes to the mask's DOM element.
     */
    mask?: IconPassThroughOptionType;
    /**
     * Used to manage all lifecycle hooks.
     * @see {@link ComponentHooks}
     */
    hooks?: ComponentHooks;
    /**
     * Used to control Vue Transition API.
     */
    transition?: IconPassThroughTransitionType;
}

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

/**
 * Defines current inline state in Icon component.
 */
export interface IconState {
    /**
     * Current container visible state as a boolean.
     * @defaultValue false
     */
    containerVisible: boolean;
    /**
     * Style id of the component.
     */
    id: string;
    /**
     * Index of the first item as a number.
     * @defaultValue 0
     */
    activeIndex: number;
    /**
     * Number of items per page as a number.
     * @defaultValue 3
     */
    numVisible: number;
    /**
     * Current slide active state as a boolean.
     * @defaultValue false
     */
    slideShowActive: boolean;
    /**
     * Number of items per page as a number.
     * @defaultValue 3
     */
    d_numVisible: number;
    /**
     * Old number of items per page as a number.
     * @defaultValue 3
     */
    d_oldNumVisible: number;
    /**
     * Current active item index as a number.
     * @defaultValue 0
     */
    d_activeIndex: number;
    /**
     * The previous active item index as a number.
     * @defaultValue 0
     */
    d_oldActiveItemIndex: number;
    /**
     * Index of the first item.
     * @defaultValue 0
     */
    page: number;
    /**
     * Total shifted items' count as a number.
     * @defaultValue 0
     */
    totalShiftedItems: number;
}

/**
 * Defines current inline options in Icon component.
 */
export interface IconContext {
    /**
     * Current highlighted state of the indicator as a boolean.
     * @defaultValue false
     */
    highlighted: boolean;
}

/**
 * Defines valid properties in Icon component.
 */
export interface IconProps {
    icon: string;
    iconStyle?: string;
    spin?: boolean;
    /**
     * 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 {IconPassThroughOptions}
     */
    pt?: PassThrough<IconPassThroughOptions>;
    /**
     * 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 Icon slots.
 */
export interface IconSlots {
    /**
     * Custom header template.
     */
    header(): VNode[];

    /**
     * Custom footer template.
     */
    footer(): VNode[];

    /**
     * Custom item template.
     * @param {Object} scope - item slot's params.
     */
    item(scope: {
        /**
         * Item instance
         */
        item: any;
    }): VNode[];

    /**
     * Custom caption template.
     * @param {Object} scope - caption slot's params.
     */
    caption(scope: {
        /**
         * Item instance
         */
        item: any;
    }): VNode[];

    /**
     * Custom indicator template.
     * @param {Object} scope - indicator slot's params.
     */
    indicator(scope: {
        /**
         * Index of the indicator item
         */
        index: number;
    }): VNode[];

    /**
     * Custom thumbnail template.
     * @param {Object} scope - thumbnail slot's params.
     */
    thumbnail(scope: {
        /**
         * Item instance
         */
        item: any;
    }): VNode[];

    /**
     * Custom close icon template.
     */
    closeicon(): VNode[];

    /**
     * Custom navigator previous item icon template.
     */
    previousitemicon(): VNode[];

    /**
     * Custom navigator next item icon template.
     */
    nextitemicon(): VNode[];

    /**
     * Custom thumbnail previous icon template.
     */
    previousthumbnailicon(): VNode[];

    /**
     * Custom thumbnail next item template.
     */
    nextthumbnailicon(): VNode[];
}

/**
 * Defines valid emits in Icon component.
 */
export interface IconEmitsOptions {
    /**
     * Emitted when the active index changes.
     * @param {number} value - Index of new active item.
     */
    'update:activeIndex'(value: number): void;

    /**
     * Emitted when the visible changes.
     * @param {boolean} value - New value.
     */
    'update:visible'(value: boolean): void;
}

export declare type IconEmits = EmitFn<IconEmitsOptions>;

/**
 * **DigiVue - Icon**
 *
 * _Icon is an advanced content gallery component._
 *
 * @group Component
 *
 */
declare const Icon: DefineComponent<IconProps, IconSlots, IconEmits>;

declare module 'vue' {
    export interface GlobalComponents {
        Icon: DefineComponent<IconProps, IconSlots, IconEmits>;
    }
}

export default Icon;
