import { lang, langs, ui18n } from '@/lang'

export enum ResCode {
  TOKEN_INVALID = 4008,
  NO_ACCESS = 4010,
  SUCCESS = 0
}

export const all = '___all___'
export type All = typeof all

export const ResCodeDesc: { [key in ResCode]: string } = {
  [ResCode.TOKEN_INVALID]: ui18n.t('sys.TOKEN_INVALID'),
  [ResCode.NO_ACCESS]: ui18n.t('sys.NO_ACCESS'),
  [ResCode.SUCCESS]: ui18n.t('sys.SUCCESS')
}

if (lang in langs) {
  Object.assign(ResCodeDesc, langs[lang].code)
}

// 上传文件
export const UPLOAD_FILE = '/smart-site/upload/file'

// 用户
export const POST_LOGIN = '/smart-site/fdLogin'
export const POST_LOGOUT = '/smart-site/fdLogout'
export const GET_USER = '/smart-site/getUserInfo'
export const GET_USER_META = '/smart-site/project/userData'

// 项目
export const GET_PROJECT_LIST = '/smart-site/project/list'
export const GET_PROJECT = '/smart-site/project/info'
export const ADD_PROJECT = '/smart-site/project/add'
export const UPDATE_PROJECT = '/smart-site/project/updateName'
export const FINE_PROJECT = '/smart-site/project/over'
export const DEL_PROJECT = '/smart-site/project/del'

// 操作记录
export const GET_RECORD_LIST = '/smart-site/projectLog/list'

// 场景
export const GET_SCENE_LIST = '/smart-site/scene/list'
export const REPLACE_SCENES = '/smart-site/project/addScene'
export const DEL_SCENE = '/smart-site/project/delScene'

// bim
export const UPLOAD_BIM = '/smart-site/upload/bim'
export const DEL_BIM = '/smart-site/project/deleteBim'
export const UPDATE_BIM_NAME = '/smart-site/project/updateBimName'

// 成员
export const GET_MEMBER_LIST = '/smart-site/projectTeam/list'
export const CHECK_MEMBER_PHONE = '/smart-site/projectTeam/checkUserName'
export const ADD_MEMBER = '/smart-site/projectTeam/addUser'
export const DEL_MEMBER = '/smart-site/projectTeam/deleteUser'
export const UPDATE_MEBER = '/smart-site/projectTeam/updateUser'

// 标注
export const GET_TAGGING_LIST = '/smart-site/marking/list'
// 标注总览
export const GET_TAGGING_TOTAL = '/smart-site/marking/count'

// 角色
export const GET_ROLE_LIST = '/smart-site/role/list'
export const ADD_ROLE = '/smart-site/role/addOrUpdate'
export const DEL_ROLE = 'smart-site/role/del'
export const UPDATE_ROLE = '/smart-site/role/addOrUpdate'
export const ROLE_OPTIONS = '/smart-site/menu/treeselect/all'
// export const USER_ROLE_OPTIONS = '/smart-site/menu/treeselect'
export const USER_ROLE_OPTIONS = '/smart-site/menu/menuselect'
export const PROJECT_ROLE_OPTIONS = '/smart-site/menu/treeselect'
export const SELECT_OPTIONS = '/smart-site/role/select'
