export interface DialogPlugin {
    open: (component: any,props?: Record<string, any>) => Promise<any>
    openPromise: (component: any, promiseInput: Promise<any> | (() => any | Promise<any>) | (Promise<any> | (() => any | Promise<any>))[], props?: Record<string, any>) => Promise<any | any[]>
    confirm: (props?: Record<string, any>) => Promise<boolean>
    notify: (props?: Record<string, any>) => Promise<boolean>
    verifyUser: (props?: Record<string, any>) => Promise<boolean>
    loading: <T>(promiseInput: Promise<any> | (() => any | Promise<any>) | (Promise<any> | (() => any | Promise<any>))[],props?: Record<string, any>) => Promise<any | any[]>
    printing: <T>(promiseInput: Promise<any> | (() => any | Promise<any>) | (Promise<any> | (() => any | Promise<any>))[],props?: Record<string, any>) => Promise<any | any[]>
    setDialogHost: (openFn: DialogOpenFn,closeFn: DialogCloseFn) => void
    setDialogComponents: (components:object) => void
}

export interface DialogOpenResult<T = any> {
    id: number
    promise: Promise<T>
    closeInstance: (value?: T) => void
    rejectInstance: (value?: T) => void
}

export interface DialogOpenFn {
    (component: any, props?: Record<string, any>): DialogOpenResult
}

export interface DialogCloseFn {
    (id: number, value?: any): void
}

declare module '#app' {
    interface NuxtApp {
        $dialog: DialogPlugin
    }

    interface RuntimeNuxtApp {
        $dialog: DialogPlugin
    }
}