import Cookies from 'store';

const TokenKey = 'WPR-Token';
const SSOConfigKey = 'SY-SSOCONFIG';
const MenuVisibleKey = 'WPR-MENUS-VISIBLE';
const PlatformTokenKey = 'PLATFORM-Token';
const SYSTEMAPPMENUCFGID = 'SYS_WPR_MENUCFGID';

export function getToken() {
  return Cookies.get(TokenKey);
}

export function setToken(token) {
  return Cookies.set(TokenKey, token);
}

export function removeToken() {
  return Cookies.remove(TokenKey);
}

export function getSSOConfig() {
  return Cookies.get(SSOConfigKey);
}

export function setSSOConfig(token) {
  return Cookies.set(SSOConfigKey, token);
}

export function removeSSOConfig() {
  return Cookies.remove(SSOConfigKey);
}

export function getMenuVisible() {
  return Cookies.get(MenuVisibleKey);
}

export function setMenuVisible(flag) {
  return Cookies.set(MenuVisibleKey, flag);
}

export function removeMenuVisible() {
  return Cookies.remove(MenuVisibleKey);
}

export function getPlatformToken() {
  return Cookies.get(PlatformTokenKey);
}

export function setPlatformToken(token) {
  return Cookies.set(PlatformTokenKey, token);
}

export function removePlatformToken() {
  return Cookies.remove(PlatformTokenKey);
}

export function getSysMenuConfigID() {
  return (
    Cookies.get(SYSTEMAPPMENUCFGID) || process.env.VUE_APP_SYS_APP_MENUCFGID
  );
}

export function setSysMenuConfigID(token) {
  return Cookies.set(SYSTEMAPPMENUCFGID, token);
}

export function removeSysMenuConfigID() {
  return Cookies.remove(SYSTEMAPPMENUCFGID);
}
