export const notify = (conclusion,messages, ...options) => {
   const [url,timeout]=options
    let time
    if (timeout===undefined && typeof timeout!=="number") {
        time=2000
    } else {
        time=timeout
    }
    switch (conclusion) {
        case "success":
            Notiflix.Notify.success(messages,
                {
                    timeout: time
                });
            break;
        case "error":
            Notiflix.Notify.failure(messages, {
                timeout: time
            });
            break;
        default:
            Notiflix.Notify.info(messages);
    }

    if (url!==undefined && url.length > 0 && url!=="") {
        setTimeout(()=>{
            window.location.href=url
        },time)
    }
}

export const loading = (conclusion) => {
    if (conclusion) {
        Notiflix.Loading.dots("Lütfen Bekleyiniz");
    } else {
        Notiflix.Loading.remove();
    }
}

export const notiConfirm = (title, messages, buttonOkText, buttonCanceledText, ...options) => {
    const [vectorMapChanged,process,code,...init]=options

    Notiflix.Confirm.show(
        `${title}`,
        `${messages}`,
        `${buttonOkText}`,
        `${buttonCanceledText}`,
        () => {
         vectorMapChanged(process,code)
        },
        () => {
            return false
        },
        ...init
    );
}