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

// ==================== 支付通道相关 API ====================

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

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

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

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

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

// ==================== 支付类型相关 API ====================

export function fetchTypeList(channelId: string, query?: Object) {
	return request({
		url: `admin/paymentType/list/${channelId}`,
		method: 'get',
		params: query,
	});
}

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

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

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

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

// ==================== 后续可添加其他支付相关 API ====================
// 例如：支付订单、支付记录等
