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

/**
 * 申请加入用工邀请
 * POST /api/v1/mp/worker-registration/apply
 * 需临时工 JWT；body.scene 为小程序码 / qrToken（订单编号）
 * @param {{ scene: string, confirmedWorkType?: string }} data
 */
export function applyWorkerRegistration(data = {}, options = {}) {
	const scene = data.scene == null ? '' : String(data.scene).trim()
	const confirmedWorkType = data.confirmedWorkType == null && data.confirmed_work_type == null
		? ''
		: String(data.confirmedWorkType || data.confirmed_work_type || '').trim()
	const body = { scene }
	if (confirmedWorkType) {
		body.confirmedWorkType = confirmedWorkType
		body.confirmed_work_type = confirmedWorkType
	}
	return post('/worker-registration/apply', body, options)
}
