/*
 * @Author: 吴文洁
 * @Date: 2020-08-31 09:34:25
 * @LastEditors: wufan
 * @LastEditTime: 2021-01-09 15:50:08
 * @Description: 
 * @Copyright: 杭州杰竞科技有限公司 版权所有
 */

import Storage from './storage';
import { PREFIX } from '@/domains/basic-domain/constants';

class User {
  
  getStoreId(){
    return Storage.get(`${PREFIX}_storeId`)
  }

  getEnterpriseId() {
    return Storage.get(`${PREFIX}_enterpriseId`)
  }

  getStoreName(){
    return Storage.get(`${PREFIX}_storeName`) 
  }

  getStoreType(){
    return Storage.get(`${PREFIX}_storeType`) 
  }

  getStoreUserId(){
    return Storage.get(`${PREFIX}_storeUserId`)
  }

  getUserId(){
    return Storage.get(`${PREFIX}_userId`)
  }
  getUserRole(){
    return Storage.get(`${PREFIX}_userRole`)
  }

  getToken() {
    return Storage.get(`${PREFIX}_token`);
  }

  getIsAdmin() {
    return Storage.get(`${PREFIX}_isAdmin`);
  }

  setStoreId(value:any){
    return Storage.set(`${PREFIX}_storeId`,value)
  }

  setEnterpriseId(value: any) {
    return Storage.set(`${PREFIX}_enterpriseId`,value)
  }

  setStoreName(value:any){
    return Storage.set(`${PREFIX}_storeName`,value) 
  }

  setStoreType(value:any){
    return Storage.set(`${PREFIX}_storeType`,value) 
  }

  setStoreUserId(value:any){
    return Storage.set(`${PREFIX}_storeUserId`,value)
  }

  setUserId(value:any){
    return Storage.set(`${PREFIX}_userId`,value)
  }

  setUserRole(value:any){
    return Storage.set(`${PREFIX}_userRole`,value)
  }

  setToken(value:any) {
    return Storage.set(`${PREFIX}_token`,value);
  }

  setIsAdmin(value: any) {
    return Storage.set(`${PREFIX}_isAdmin`, value);
  }

  removeToken(){
    return Storage.remove(`${PREFIX}_token`);
  }

  removeUserId(){
    return Storage.remove(`${PREFIX}_userId`);
  }

  removeEnterpriseId() {
    return Storage.remove(`${PREFIX}_enterpriseId`)
  }
}

export default new User();