import Vue from 'vue';
import Vuex from 'vuex';
import jwt from 'jsonwebtoken';
import * as ustate from '@common/src/store/user/state';
import * as umutations from '@common/src/store/user/mutations';
// 保安员报名-基本信息表
import security_guard_base from '@common/src/store/security_guard_base';
// 保安员报名-其他信息表
import security_guard_others from '@common/src/store/security_guard_others';
// 保安员报名-人像采集
import security_guard_collect from '@common/src/store/security_guard_collect';
// 保安员统计
import baoan_statis from '@common/src/store/baoan_statis';
//电子资料表
import digital_files from '@common/src/store/digital_files';
// 政审，报名审核，审批
import security_guard_qualifications from '@common/src/store/security_guard_qualifications';
// 考场信息编排
import examination_room from '@common/src/store/examination_room';
// 报名缴费
import examination_examinee from '@common/src/store/examination_examinee';
// 保安员证件表
import certificates_base from '@common/src/store/certificates_base';
// 保安员证件发放表
import certificates_grant from '@common/src/store/certificates_grant';
// 保安员证件打印日志
import certificates_print_log from '@common/src/store/certificates_print_log';
// 保安员补打申请表
import certificates_print_again from '@common/src/store/certificates_print_again';
// 日常检查表
import daily_inspection from '@common/src/store/daily_inspection';
// 企业奖励表
import enterprise_reward from '@common/src/store/enterprise_reward';
// 投诉信息表
import complaints_info from '@common/src/store/complaints_info';
// 协查通报表
import assistance_investigation from '@common/src/store/assistance_investigation';
// 协查通报回复表
import assistance_investigation_reply from '@common/src/store/assistance_investigation_reply';
// 综合信息查询
// 武器装备
import company_equipment from '@common/src/store/company_equipment';
// 车辆信息
import company_car from '@common/src/store/company_car';
// 枪支信息
import company_gun from '@common/src/store/company_gun';
// 采集信息预约记录信息
import reserve_collect from '@common/src/store/reserve_collect';
// 已预约采集信息记录
import reserve_record from '@common/src/store/reserve_record';

// 部门表
import police_department from '@common/src/store/police_department';
import login from '@common/src/store/login';
import system_account from '@common/src/store/system_account';
import company_base from '@common/src/store/company_base';
import company_applicant from '@common/src/store/company_applicant';
import company_shareholders from '@common/src/store/company_shareholders';
import company_managers from '@common/src/store/company_managers';
import company_information from '@common/src/store/company_information';
import company_teachers from '@common/src/store/company_teachers';
import company_person_charge from '@common/src/store/company_person_charge';
import company_service_area from '@common/src/store/company_service_area';
import company_legal_person from '@common/src/store/company_legal_person';
// 服务对象
import company_service_object from '@common/src/store/company_service_object';
// 服务许可证表
import company_licence from '@common/src/store/company_licence';
// 服务许可证发放表
import company_licence_grant from '@common/src/store/company_licence_grant';

import company_keep from '@common/src/store/company_keep';

import company_keep_grant from '@common/src/store/company_keep_grant';

// 企业入职表
import company_baoan_work from '@common/src/store/company_baoan_work';

// 企业审核
import company_examine from '@common/src/store/company_examine';
// 企业受理
import company_accept from '@common/src/store/company_accept';
// 法人变更申请
import company_legal_change from '@common/src/store/company_legal_change';
// 保安资讯信息
import baoan_news from '@common/src/store/baoan_news';
// 异常警告表
import baoan_work_warning from '@common/src/store/baoan_work_warning';

// 位置监控
import position from '@common/src/store/position';

// 首页企业统计
import home_company from '@common/src/store/home_company';
// 首页保安员统计
import home_security from '@common/src/store/home_security';
// 模板消息
import sendTemplate from '@common/src/store/sendTemplate';

// 角色
import systen_role from '@common/src/store/system_role';

// 协会端账号
import society_account from '@common/src/store/society_account';

// 考试端账号
import exam_account from '@common/src/store/exam_account';

// 文件导入-保安员报名信息导入，考试成绩导入
import import_file from '@common/src/store/import_file';
// 服务端对服务端
import upload from '@common/src/store/upload';

// 发送消息
import message from '@common/src/store/message';

// 保安员服务派遣
import company_baoan_dispatch from '@common/src/store/company_baoan_dispatch';

Vue.use(Vuex);

export default new Vuex.Store({
  state: { ...ustate },
  mutations: { ...umutations },
  actions: {},
  modules: {
    login,
    security_guard_base,
    security_guard_others,
    security_guard_collect,
    baoan_statis,
    digital_files,
    police_department,
    security_guard_qualifications,
    examination_room,
    examination_examinee,
    certificates_base,
    certificates_grant,
    certificates_print_log,
    certificates_print_again,
    daily_inspection,
    enterprise_reward,
    complaints_info,
    assistance_investigation,
    assistance_investigation_reply,
    system_account,
    company_base,
    company_applicant,
    company_shareholders,
    company_managers,
    company_information,
    company_teachers,
    company_person_charge,
    company_service_area,
    company_legal_person,
    company_service_object,
    company_examine,
    company_accept,
    company_equipment,
    company_car,
    company_gun,
    company_licence,
    company_licence_grant,
    company_baoan_work,
    company_keep,
    company_keep_grant,
    company_legal_change,
    baoan_news,
    baoan_work_warning,
    position,
    home_company,
    home_security,
    sendTemplate,
    systen_role,
    society_account,
    exam_account,
    import_file,
    reserve_collect,
    reserve_record,
    upload,
    message,
    company_baoan_dispatch,
  },
  getters: {
    tokenInfo(state) {
      const token = state.token;
      let result;
      if (token) {
        const data = jwt.decode(token);
        result = data;
      }
      return result;
    },
  },
});
