import {Cookie} from "./tg_app/Cookie.js";
import {TgApp} from "./tg_app/TgApp.js";
import {SimpleRouter} from "./tg_app/SimpleRouter.js";

document.addEventListener("DOMContentLoaded", () => {
    let tg = window.Telegram.WebApp;
    let tgApp = new TgApp("tg_app", tg.initDataUnsafe.user.id);

    // const router = new Router({
    //     mode: 'hash',
    //     root: '/miniapp'
    // });

    const cookie = new Cookie();
    const routes = {
        '/miniapp': () => {
            cookie.setCookie("dialog_id", tg.initDataUnsafe.user.id, 3)
            tgApp.actionMain();
        },

    };

// Инициализация роутера
    const router = new SimpleRouter(routes);

    // const router
    //     .add('/', () => {
    //         cookie.setCookie("dialog_id", tg.initDataUnsafe.user.id, 3)
    //         tgApp.actionMain();
    //     })
    //     .add('/scanner', () => {
    //         tgApp.createScanner();
    //     });

});