import { defineStore } from 'pinia';

import Noty from 'noty';


export const useNotificationStore = defineStore('notification', {
    actions: {
        createNotification({ title, message, type }: { title: string; message: string; type: Noty.Type }) {
            const content = `<div class="row">
                <div class="col">
                    <div class="row">
                        <div class="col all-caps fs-13 bold">${title}</div>
                    </div>
                    <div class="row fs-12 m-t-5">
                        <div class="col">${message}</div>
                    </div>
                </div>
            </div>`;

            new Noty({
                type: type,
                text: content,
                timeout: 5000,
                closeWith: ['button'],
                layout: "bottomRight",
                theme: "metroui"
            }).show();
        }
    }
});
