import {EventBus} from './EventBus.service.js'

export class Message {
    static get() {
        if ( !this.instance ) {
            this.instance = new Message()
        }

        return this.instance
    }

    alert({ type, message, timeout = 0, onDismiss = () => {} }) {
        return EventBus.get()
            .event('message.alert')
            .fire({ type, message, timeout, onDismiss })
    }

    modal({ title, message, buttons = [], inputs = [] }) {
        return EventBus.get()
            .event('message.modal')
            .fire({ title, message, buttons, inputs })
    }
}
