import {
	request
} from "./http.js";
// 公共API 
const apiPath = {
	getSelfProjectList: '/api/proj/listpage/self', //获取我的项目列表
	getTagList: '/api/proj/tag/list-tag', //获取标签
	getNotice: '/api/env/custom/get-proj-create-notice', //获取notice
	getPrice: '/api/proj/charge/get', //获取创建项目的单价
	getContactList: '/api/proj-contact/list/self', //获取产权联系人列表
	getCouponsList: '/api/coupon/user/listpage/self', //获取我可以使用的优惠卷
	getPackageList: '/api/proj/servicepkg/packageorder/listpage/self', //获取套餐包
	getCommendProjectName: '/api/proj/recommend/list-proj-name/ai', //推荐项目名称
	createProject: '/api/proj/create-quick', //快速创建项目
	buildProject: '/api/proj/create-quick/proj-id/{projId}', //生成项目
	reCreate: '/api/proj/generate/proj-id/${projId}', //重新生成
	proLangList: '/api/env/custom/list-active-lang', //项目语言
	ruleData: '/app/agreementportal/getrelease/{id}', //使用规则 project="operator"
	investDetail: "/news-content/listpage?rows=1&page=1", //投资优势
	mainProCount: '/api/env/custom/get-proj-counts', //首页介绍数量
	repairProList: '/api/proj/correction/apply/listpage/self', //我的补正
	canProRepairList: '/api/proj/correction/apply/listpage-proj-unapply/self', //可以补正的项目列表
	cancelProPepair: '/api/proj/correction/apply/cancel/self/{projCorrectionApplyId}', //取消补正
	applyProRepair: '/api/proj/correction/apply/save', //申请补正
	refundProList: '/api/proj/refund/apply/listpage/self', //我的退款项目
	canRefundProList: '/api/proj/refund/apply/listpage-proj-unapply/self', //可以退款的项目
	applyRefundPro: '/api/proj/refund/apply/save', //申请退款
	cancelRefundPro: '/api/proj/refund/apply/cancel/self/{projRefundApplyId}', //取消申请退款
	dealDetail: '/api/agreementportal/get/{id}', //协议operator
}
class ProApi {
	//首页介绍数量
	static doGetMainProCount() {
		return request(apiPath.mainProCount, 'GET')
	}
	//项目列表
	static doGetSelfProjectList(data) {
		return request(apiPath.getSelfProjectList, 'GET', data)
	}
	//获取标签
	static doGetTagList() {
		return request(apiPath.getTagList, "GET")
	}
	//获取通知
	static doGetNotice() {
		return request(apiPath.getNotice, "GET")
	}
	//获取价格
	static doGetPrice() {
		return request(apiPath.getPrice, "GET")
	}
	static doGetContactList() {
		return request(apiPath.getContactList, "GET")
	}
	//获取套餐包
	static doGetPackageList(data) {
		return request(apiPath.getPackageList, "GET", data)
	}
	//优惠卷
	static doGetCouponseList(data) {
		return request(apiPath.getCouponsList, "GET", data)
	}
	//推荐项目名称
	static doGetCommendProjectName(data) {
		return request(apiPath.getCommendProjectName, "POST", data)
	}
	//创建项目
	static doCreateProject(data) {
		return request(apiPath.createProject, "POST", data)
	}
	//生成项目
	static doBuildProject(id) {
		const path = apiPath.buildProject.replace('{projId}', id)
		return request(path, "GET")
	}
	//重新生成
	static doReCreate(url) {
		const path = apiPath.reCreate.replace('${projId}', url)
		return request(path, "POST")
	}
	//获取项目可选语言
	static doGetProLangList() {
		return request(apiPath.proLangList, "GET")
	}
	//获取使用规则数据
	static doGetRuleDate(id) {
		const path = apiPath.ruleData.replace('{id}', id)
		return request(path, "GET", null, "operator", false)
	}
	static doGetInvestDetail(data) {
		return request(apiPath.investDetail, "GET", data)
	}
	//我的补正项目列表
	static doGetMineRepairList(data) {
		return request(apiPath.repairProList, "GET", data)
	}
	//撤销补正
	static doCancelProrepair(id) {
		const path = apiPath.cancelProPepair.replace('{projCorrectionApplyId}', id)
		return request(path, 'PUT')
	}
	//提交补正
	static doApplyProRepair(data) {
		return request(apiPath.applyProRepair, "POST", data)
	}
	//获取可以补正的项目列表
	static doGetCanProRepairList(data) {
		return request(apiPath.canProRepairList, "GET", data)
	}
	//退款项目列表
	static doGetMineRefundProList(data) {
		return request(apiPath.refundProList, "GET", data)
	}
	static doGetCanRefundProList(data) {
		return request(apiPath.canRefundProList, "GET", data)
	}
	//取消申请退款
	static doCancelRefundPro(id) {
		const path = apiPath.cancelRefundPro.replace('{projRefundApplyId}', id)
		return request(path, "PUT")
	}
	//提交申请退款
	static doApplyRefundPro(data) {
		return request(apiPath.applyRefundPro, "POST", data)
	}
	//获取协议详情
	static doGetDealDetail(id) {
		const path = apiPath.dealDetail.replace('{id}', id)
		return request(path, "GET", null, "operator", true)
	}
}

export default ProApi;