import request from '/@/utils/request';

// ==================== 代理商用户相关 API ====================

export function fetchList(query?: Object) {
	return request({
		url: 'admin/agentUser/page',
		method: 'get',
		params: query,
	});
}

export function addObj(obj?: Object) {
	return request({
		url: 'admin/agentUser/save',
		method: 'post',
		data: obj,
	});
}

export function getObj(id?: string) {
	return request({
		url: `admin/agentUser/info/${id}`,
		method: 'get',
	});
}

export function putObj(id: string, obj?: Object) {
	return request({
		url: `admin/agentUser/edit/${id}`,
		method: 'patch',
		data: obj,
	});
}

export function changeStatus(id: string) {
	return request({
		url: `/admin/agentUser/changeStatus/${id}`,
		method: 'patch',
	});
}

export function changePwd(id: string, data?: Object) {
	return request({
		url: `/admin/agentUser/changePwd/${id}`,
		method: 'patch',
		data: data,
	});
}

// ==================== 代理商支付通道相关 API ====================

export function fetchAgentPaymentTypeList(agentUserId: string, paymentType: 'PAY' | 'HARVEST') {
	return request({
		url: 'admin/agentPaymentType/list',
		method: 'get',
		params: {
			agentUserId,
			paymentType,
		},
	});
}

export function editAgentPaymentType(obj?: Object) {
	return request({
		url: 'admin/agentPaymentType/edit',
		method: 'post',
		data: obj,
	});
}
