import { _objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import dayjs from "dayjs";
//#region src/plus/salesSdk/demo/fixtures.ts
/**
* SalesSdkDemo 一键测试用例的默认 fixture。
*
* 三个 Tab（详情 / 新建 / 编辑）的默认参数集中在此，便于：
*  - demo 自身一键复现固定测试用例（不依赖任何 mock）
*  - 高级配置面板把 override 与 base merge 后再交给 step runner
*  - 顶层 SalesSdkDemoProps（osKey/orderId 等）覆盖 fixture（消费方可强制传业务参数）
*/
/** 默认用当天，与 Provider initBookingContext / loadProducts 日期同步一致 */
function createDefaultLoadProductsParams() {
	const today = dayjs().format("YYYY-MM-DD");
	return {
		schedule_date: today,
		menu_list_ids: [44858],
		schedule_datetime: dayjs().format(`${today} HH:mm:ss`)
	};
}
const DEFAULT_LOAD_PRODUCTS_PARAMS = createDefaultLoadProductsParams();
const FIXTURE_DETAIL = { orderId: 97807 };
const FIXTURE_CREATE = {
	loadProductsParams: _objectSpread2({}, DEFAULT_LOAD_PRODUCTS_PARAMS),
	customerId: void 0,
	productPicker: {
		variantIndex: 0,
		num: 1
	}
};
const FIXTURE_EDIT = {
	orderId: FIXTURE_DETAIL.orderId,
	loadProductsParams: _objectSpread2({}, DEFAULT_LOAD_PRODUCTS_PARAMS),
	customerId: void 0,
	productPicker: {
		variantIndex: 0,
		num: 1
	},
	orderNote: "SalesSdk demo note",
	shopDiscount: 5,
	contactsInfo: {
		name: "Demo Contact",
		phone: "13800000000"
	}
};
/**
* 浅合并 fixture base 与用户 override。
* 对 `loadProductsParams` / `productPicker` 这两个对象字段做一层 spread，避免被 override 整体替换掉。
*/
/** 合并时忽略 undefined，避免 override 把 base 默认值冲掉；null 仍保留（如 contactsInfo 清空） */
function omitUndefined(obj) {
	return Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== void 0));
}
function mergeMutableFixture(base, override) {
	if (!override) return base;
	const cleaned = omitUndefined(override);
	return _objectSpread2(_objectSpread2(_objectSpread2({}, base), cleaned), {}, {
		loadProductsParams: _objectSpread2(_objectSpread2({}, base.loadProductsParams), override.loadProductsParams || {}),
		productPicker: _objectSpread2(_objectSpread2({}, base.productPicker), override.productPicker || {})
	});
}
function mergeDetailFixture(base, override) {
	if (!override) return base;
	return _objectSpread2(_objectSpread2({}, base), override);
}
//#endregion
export { FIXTURE_CREATE, FIXTURE_DETAIL, FIXTURE_EDIT, mergeDetailFixture, mergeMutableFixture };
