import store from "../store";
export default {
  AuthorizationRoles: {
    ///<summary>No role set</summary>
    NoRole: 0,
    ///<summary>BizAdminLimited</summary>
    BizAdminLimited: 1,
    ///<summary>BizAdminFull</summary>
    BizAdminFull: 2,
    ///<summary>DispatchLimited</summary>
    DispatchLimited: 4,
    ///<summary>DispatchFull</summary>
    DispatchFull: 8,
    ///<summary>InventoryLimited</summary>
    InventoryLimited: 16,
    ///<summary>InventoryFull</summary>
    InventoryFull: 32,
    ///<summary>AccountingFull</summary>
    AccountingFull: 64, //No limited role, not sure if there is a need
    ///<summary>TechLimited</summary>
    TechLimited: 128,
    ///<summary>TechFull</summary>
    TechFull: 256,
    ///<summary>SubContractorLimited</summary>
    SubContractorLimited: 512,
    ///<summary>SubContractorFull</summary>
    SubContractorFull: 1024,
    ///<summary>ClientLimited</summary>
    ClientLimited: 2048,
    ///<summary>ClientFull</summary>
    ClientFull: 4096,
    ///<summary>OpsAdminLimited</summary>
    OpsAdminLimited: 8192,
    ///<summary>OpsAdminFull</summary>
    OpsAdminFull: 16384
  },
  hasRole(role) {
    if (!store.state.roles || store.state.roles === 0) {
      return false;
    }
    return role === (store.state.roles & role);
  }
};
