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

/**
 * 按草稿 ID 查询关联企业信息
 * GET /api/v1/mp/enterprise/by-draft/{draftId}
 * @param {number|string} draftId
 */
export function getEnterpriseByDraft(draftId, options = {}) {
	return get(`/enterprise/by-draft/${draftId}`, {}, options)
}

/**
 * 企业登记/认证
 * POST /enterprise/register
 * 必填 draftId：认证成功后回填该草稿及对应订单、登记批次的 enterprise_id
 * @param {{
 *   draftId: number|string,
 *   name: string,
 *   creditCode: string,
 *   legalPerson: string,
 *   registeredAddress: string,
 *   contactName: string,
 *   contactMobile: string
 * }} data
 */
export function registerEnterprise(data) {
	return post('/enterprise/register', data)
}
