import Cookies from 'js-cookie'

const TOKEN_KEY = 'C_TOKEN'

export function getToken() {
  return Cookies.get(TOKEN_KEY)
}

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

export function removeToken() {
  return Cookies.remove(TOKEN_KEY)
}

const UID_KEY = 'C_UID'

export function getUid() {
  return Cookies.get(UID_KEY)
}

export function setUid(id) {
  return Cookies.set(UID_KEY, id)
}

export function removeUid() {
  return Cookies.remove(UID_KEY)
}

const USERNAME_KEY = 'C_USERNAME'

export function getUsername() {
  return Cookies.get(USERNAME_KEY)
}

export function setUsername(name) {
  return Cookies.set(USERNAME_KEY, name)
}

export function removeUsername() {
  return Cookies.remove(USERNAME_KEY)
}

const PUB_KEY = 'PUB_KEY'

export function getPubKey() {
  return Cookies.get(PUB_KEY)
}

export function setPubKey(name) {
  return Cookies.set(PUB_KEY, name)
}

export function removeAll() {
  Cookies.remove(TOKEN_KEY)
  Cookies.remove(UID_KEY)
  Cookies.remove(USERNAME_KEY)
  Cookies.remove(PUB_KEY)
}
