import axios from 'axios';
import config from '@api/config.js';
import qs from 'qs'

const urls = config.urls;

export default {
	open(data) {
		return axios.post(urls.addOrder, {
			'productId': data.idList
		})
	},
	getUserAuthStatus() {
		return axios.post(urls.getUserAuthenticationStatus);
	},
	getUserAuthInfo() { //账户信息
		return axios.post(urls.getuserAuthenticationInfo);
	},
	getUserAuthcation() {
		return axios.post(urls.userAuthentication);
	},
	getUserEnumsData() {    //枚举数据
		return axios.post(urls.getUserEnumsData,{
		});
	},
	userAuthentication(data) { //用户认证
		return axios.post(urls.userAuthentication, {
			"organization": data.organizationName,
			"username": data.username,
			"position": data.position,
			"organizationAddress": data.organizationAddress,
			"organizationPrincipal": data.organizationPrincipal,
			"organizationType": data.organizationTypeNum,
			"subOrganizationNum": data.subOrganizationNum
		});
	},
	createServiceToken(data) { //生成令牌
		return axios.post(urls.createServiceToken, {
			'productId': data.productId,
			'serviceId': data.serviceId
		})
	},
	alreadyServiceToken(data) { //已生成令牌
		return axios.post(urls.alreadyServiceToken, {
			'current': data.current,
			'size': data.size
		})
	},
  getTrialProduct() {//更多服务产品展示
    return axios.post(urls.getTrialProduct)
  },
  opendedProduct() {//用户已开通产品
    return axios.post(urls.opendedProduct)
  },
  getService() {//获取服务端
    return axios.post(urls.getService)
  },
  addService(data) {//添加服务端
    return axios.post(urls.addService, {
      'description': data.desc,
      'name': data.name
    })
  },
  manageService(data) {//管理服务端
    return axios.post(urls.manageService, {
      'current': data.current,
      'size': data.size
    })
  },
  deleteService(id) {//删除服务端
    return axios.post(urls.deleteService + '?serviceId=' + id)
  },
  createServiceToken(data) {//生成令牌
    return axios.post(urls.createServiceToken, {
      'productId': data.productId,
      'serviceId': data.serviceId
    })
  },
  alreadyServiceToken(data) {//已生成令牌
    return axios.post(urls.alreadyServiceToken, {
      'current': data.current,
      'size': data.size
    })
  },
  /*delProductService(data) {//已生成令牌-删除
    return axios.post(urls.delProductService, {
      'productId': data.productId,
      'serviceId': data.serviceId
    })
  },*/
  delProductService(id) {//已生成令牌-删除
    return axios.post(urls.delProductService + '?productServiceId=' + id)
  },
  detailProductService(id){//已生成令牌-查看
    return axios.post(urls.detailProductService + '?productServiceId=' + id)
  },
  delServiceToken(id) {//删除令牌
    return axios.post(urls.delServiceToken + '?productServiceId=' + id)
  },
  forbidServiceToken(id) {//禁用令牌
    return axios.post(urls.disableToken + '?productServiceId=' + id)
  },
  openServiceToken(id) {//启用令牌
    return axios.post(urls.enableToken + '?productServiceId=' + id)
  },
	getConsoleOnTrial() {//可试用
		return axios.post(urls.getConsoleOnTrial)
	},
	openUpOnTrial(data) { //立即试用
		return axios.post(urls.openUpOnTrial, {
			'productId': data.productId
		})
	},
	productAuthProgress() { //申请进度
		return axios.post(urls.productAuthProgress)
	},
	getConsoleOpened() { // 控制台--已开通产品
		return axios.post(urls.getConsoleOpened)
	},
	enShowOption() { 
		return axios.post(urls.enShowOption)
	},
	addRenewalsInfo(params) { //控制台--续费
		return axios.post(urls.addRenewalsInfo,params)
	},
	getDiagbotManEnumsData(){
		return axios.post(urls.getDiagbotManEnumsData);
	},
  getAuthenProgress(){
    return axios.post(urls.getAuthenProgress);
  },
  intoVerify(params){//进入权限校验
    return axios.post(urls.intoVerify,params)
  }
}
