import tab from "./tab.plugins";
import auth from "./auth.plugins";
import modal from "./modal.plugins";
import common from "./common.plugins";
import setting from "./setting.plugins";
import time from "./time.plugins.js";
import constData from "./constData.plugins.js";
import nfc from "./nfc.plugins.js";
import keyListen from "./keyListen.plugins.js";

import config from "@/config"; // config
import { useDict } from '@/utils/dict'
import { settingStores } from "@/store/modules/index";

import dayjs from 'dayjs'
import isBetween from 'dayjs/plugin/isBetween';
import isSameOrAfter from 'dayjs/plugin/isSameOrAfter';
import isSameOrBefore from 'dayjs/plugin/isSameOrBefore';
dayjs.extend(isBetween);
dayjs.extend(isSameOrAfter)
dayjs.extend(isSameOrBefore)

export default {
  install(app) {
    // 公共请求路径
    app.provide("$BASE_URL", config.baseUrl);
    app.config.globalProperties.$BASE_URL = config.baseUrl;
    // 公共website路径
    app.provide("$websiteUrl", config.websiteUrl);
    app.config.globalProperties.$websiteUrl = config.websiteUrl;
    // 页签操作
    app.provide("$tab", tab);
    app.config.globalProperties.$tab = tab;
    // 认证对象
    app.provide("$auth", auth);
    app.config.globalProperties.$auth = auth;
    // 模态框对象
    app.provide("$modal", modal);
    app.config.globalProperties.$modal = modal;
    // 数据处理
    app.provide("$common", common);
    app.config.globalProperties.$common = common;
    // 公共设置方法
    app.provide("$setting", setting);
    app.config.globalProperties.$setting = setting;
    // 公共时间处理方法
    app.provide("$time", time);
    app.config.globalProperties.$time = time;
    // 公共默认数据存储
    app.provide("$constData", constData);
    app.config.globalProperties.$constData = constData;
    // 公共NFC
    app.provide("$nfc", nfc);
    app.config.globalProperties.$nfc = nfc;
    // 公共设置stroe
    app.provide("$settingStore", settingStores());
    app.config.globalProperties.$settingStore = settingStores();
    // 公共时间处理方法dayjs
    app.provide("$dayjs", dayjs);
    app.config.globalProperties.$dayjs = dayjs;
    // 公共字典模块
    app.config.globalProperties.useDict = useDict
    // 公共物理按钮监听
    app.provide("$keyListen", keyListen);
    app.config.globalProperties.$keyListen = keyListen;

  },
};
