import Cookies from "js-cookie";

const TokenKey = "AdminOMS-Token";

const ExpiresInKey = "AdminOMS-Expires-In";

export function getToken() {
  if (process.env.NODE_ENV === "development") {
    return "eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX2tleSI6IjdkYWZhYTcwLWJjMmEtNDg0OS05Y2MyLTViYTk2ODlhZjUwYiIsInVzZXJuYW1lIjoiYWRtaW4ifQ.pCoM4P0lCZQOsptkxdOTHQsrPrJHQ3pkrVCVzgntkaVUq-OejbwVePOQ5oC0fuW-WQe8ffkLqH9EZWNXx4Wrpw";
  } else {
    return Cookies.get(TokenKey);
  }
}

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

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

export function getExpiresIn() {
  return Cookies.get(ExpiresInKey) || -1;
}

export function setExpiresIn(time: any) {
  return Cookies.set(ExpiresInKey, time);
}

export function removeExpiresIn() {
  return Cookies.remove(ExpiresInKey);
}
