import { get, post } from '@/utils/request.js'

/**
 * 我的电子合同列表
 * GET /api/v1/mp/contracts
 * @param {{ signStatus?: string, sign_status?: string }} [params] pending|signing|signed
 */
export function listMyContracts(params = {}, options = {}) {
	const signStatus = params.signStatus || params.sign_status || ''
	const data = {}
	if (signStatus) data.sign_status = signStatus
	return get('/contracts', data, options)
}

/**
 * 合同详情
 * GET /api/v1/mp/contracts/{id}
 */
export function getContractDetail(contractId, options = {}) {
	return get(`/contracts/${contractId}`, {}, options)
}

/**
 * 确认签署完成
 * POST /api/v1/mp/contracts/{id}/confirm-sign
 */
export function confirmContractSign(contractId, options = {}) {
	return post(`/contracts/${contractId}/confirm-sign`, {}, options)
}
