class Toastr {

    static setOptions() {
        toastr.options = {
            "closeButton": false,
            "debug": false,
            "newestOnTop": false,
            "progressBar": false,
            "positionClass": "toast-bottom-right",
            "preventDuplicates": false,
            "onclick": null,
            "showDuration": "300",
            "hideDuration": "1000",
            "timeOut": "5000",
            "extendedTimeOut": "1000",
            "showEasing": "swing",
            "hideEasing": "linear",
            "showMethod": "fadeIn",
            "hideMethod": "fadeOut"
        }
    }
    static success(message) {
        toastr.success(`${message}`, `${OXYLEAF_ADMIN_SETTINGS?.labels?.toastr_success_title}`);
    }

    static error(message) {
        toastr.error(`${message}`, `${OXYLEAF_ADMIN_SETTINGS?.labels?.toastr_error_title}`);
    }

    static multipleErrors(errors) {
        if (Array.isArray(errors) && errors.length > 0) {
            if (errors.length === 1) {
                Toastr.error(errors[0]);
                return;
            }
            let out = '';
            errors.forEach(error => {
                out += `<p>${error}<p>`;
            });
            Toastr.error(out);
        }
    }
}
export default Toastr;