export class ToastController {
    /**
     * Dismiss all toasts.
     */
    async dismissAll() {
        Array.from(this.element.querySelectorAll('anj-toast')).forEach(toast => {
            toast.dismiss();
        });
    }
    /**
     * Pop a toast for bad things.
     * The first argument is the message, and the second is an optional header.
     */
    async error(message, header) {
        return this.createToast({ message, header, context: 'danger' });
    }
    /**
     * Pop a toast for whatever, we're all nihilists with neutral toasts
     * The first argument is the message, and the second is an optional header.
     */
    async message(message, header) {
        return this.createToast({ message, header });
    }
    /**
     * Pop a toast for good things.
     * The first argument is the message, and the second is an optional header.
     */
    async success(message, header) {
        return this.createToast({ message, header, context: 'success' });
    }
    /**
     * Pop a toast for things that aren't awful, but not great either.
     * The first argument is the message, and the second is an optional header.
     */
    async warn(message, header) {
        return this.createToast({ message, header, context: 'warn' });
    }
    createToast(config) {
        const toast = Object.assign(this.element.ownerDocument.createElement('anj-toast'), config);
        this.element.insertBefore(toast, this.element.firstElementChild);
        return toast;
    }
    static get is() { return "anj-toast-controller"; }
    static get encapsulation() { return "scoped"; }
    static get originalStyleUrls() { return {
        "$": ["toast-controller.scss"]
    }; }
    static get styleUrls() { return {
        "$": ["toast-controller.css"]
    }; }
    static get methods() { return {
        "dismissAll": {
            "complexType": {
                "signature": "() => Promise<void>",
                "parameters": [],
                "references": {
                    "Promise": {
                        "location": "global"
                    }
                },
                "return": "Promise<void>"
            },
            "docs": {
                "text": "Dismiss all toasts.",
                "tags": []
            }
        },
        "error": {
            "complexType": {
                "signature": "(message: string, header?: string) => Promise<HTMLAnjToastElement>",
                "parameters": [{
                        "tags": [],
                        "text": ""
                    }, {
                        "tags": [],
                        "text": ""
                    }],
                "references": {
                    "Promise": {
                        "location": "global"
                    },
                    "HTMLAnjToastElement": {
                        "location": "global"
                    }
                },
                "return": "Promise<HTMLAnjToastElement>"
            },
            "docs": {
                "text": "Pop a toast for bad things.\nThe first argument is the message, and the second is an optional header.",
                "tags": []
            }
        },
        "message": {
            "complexType": {
                "signature": "(message: string, header?: string) => Promise<HTMLAnjToastElement>",
                "parameters": [{
                        "tags": [],
                        "text": ""
                    }, {
                        "tags": [],
                        "text": ""
                    }],
                "references": {
                    "Promise": {
                        "location": "global"
                    },
                    "HTMLAnjToastElement": {
                        "location": "global"
                    }
                },
                "return": "Promise<HTMLAnjToastElement>"
            },
            "docs": {
                "text": "Pop a toast for whatever, we're all nihilists with neutral toasts\nThe first argument is the message, and the second is an optional header.",
                "tags": []
            }
        },
        "success": {
            "complexType": {
                "signature": "(message: string, header?: string) => Promise<HTMLAnjToastElement>",
                "parameters": [{
                        "tags": [],
                        "text": ""
                    }, {
                        "tags": [],
                        "text": ""
                    }],
                "references": {
                    "Promise": {
                        "location": "global"
                    },
                    "HTMLAnjToastElement": {
                        "location": "global"
                    }
                },
                "return": "Promise<HTMLAnjToastElement>"
            },
            "docs": {
                "text": "Pop a toast for good things.\nThe first argument is the message, and the second is an optional header.",
                "tags": []
            }
        },
        "warn": {
            "complexType": {
                "signature": "(message: string, header?: string) => Promise<HTMLAnjToastElement>",
                "parameters": [{
                        "tags": [],
                        "text": ""
                    }, {
                        "tags": [],
                        "text": ""
                    }],
                "references": {
                    "Promise": {
                        "location": "global"
                    },
                    "HTMLAnjToastElement": {
                        "location": "global"
                    }
                },
                "return": "Promise<HTMLAnjToastElement>"
            },
            "docs": {
                "text": "Pop a toast for things that aren't awful, but not great either.\nThe first argument is the message, and the second is an optional header.",
                "tags": []
            }
        }
    }; }
    static get elementRef() { return "element"; }
}
