import { _objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import { _objectWithoutProperties } from "../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js";
import { ClientEnum, EftposEnum, ModeEnum, PayRouteEnum, StatusEnum } from "../const.js";
import { locales } from "@pisell/utils";
//#region src/components/eftposPay/windcave/const.tsx
const _excluded = [
	"order_id",
	"name",
	"symbol",
	"amount",
	"mode",
	"number",
	"pay",
	"device",
	"net",
	"client"
];
/**
* @title: 初始化 windcave 数据
* @return store 全局数据管理
* @Author: hongbing.wang
* @Date: 2024-08-12 10:42
*/
var const_default = (params) => {
	const _ref = params || { mode: ModeEnum.Pay }, { order_id, name, symbol, amount, mode, number, pay, device, net, client } = _ref, other = _objectWithoutProperties(_ref, _excluded);
	return _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
		order_id,
		name,
		symbol,
		amount,
		mode,
		eftpos: EftposEnum.Windcave,
		key: Date.now(),
		warn: "",
		step: 0,
		type: PayRouteEnum.Step,
		title: locales.getText("page.eftpos-pay.text.loading")(mode),
		component: "",
		status: StatusEnum.Loading,
		steps: [],
		render: true,
		client: client !== "undefined" && client !== void 0 ? client : ClientEnum.Merchant,
		custom: other ? _objectSpread2(_objectSpread2({}, other), {}, {
			list: [],
			step: StepStatusEnum.Free
		}) : {
			list: [],
			step: StepStatusEnum.Free
		}
	}, typeof net !== "undefined" ? { net } : {}), typeof number !== "undefined" ? { number } : {}), typeof pay !== "undefined" ? { pay } : {}), typeof device !== "undefined" ? { device } : {});
};
let StepStatusEnum = /* @__PURE__ */ function(StepStatusEnum) {
	/**  空闲 */
	StepStatusEnum[StepStatusEnum["Free"] = 1] = "Free";
	/** 提交或插入卡 */
	StepStatusEnum[StepStatusEnum["Card"] = 2] = "Card";
	/** 选择账户 */
	StepStatusEnum[StepStatusEnum["Account"] = 3] = "Account";
	/** 选择应用 */
	StepStatusEnum[StepStatusEnum["Application"] = 4] = "Application";
	/** 输入PIN码 */
	StepStatusEnum[StepStatusEnum["Pin"] = 5] = "Pin";
	/** 处理中 */
	StepStatusEnum[StepStatusEnum["Processing"] = 6] = "Processing";
	/** 验证签名 */
	StepStatusEnum[StepStatusEnum["Receipt"] = 7] = "Receipt";
	/** 显示结果 */
	StepStatusEnum[StepStatusEnum["Wait"] = 8] = "Wait";
	return StepStatusEnum;
}({});
let StemTypeEnum = /* @__PURE__ */ function(StemTypeEnum) {
	/** 主动查询 */
	StemTypeEnum["Active"] = "active";
	/** 被动提交 */
	StemTypeEnum["Passive"] = "passive";
	return StemTypeEnum;
}({});
/**
* @title: windcave 步骤信息
* @description: 步骤对应配置信息
* @return 步骤配置信息
* @Author: hongbing.wang
* @Date: 2024-08-12 10:44
*/
const getStepMapping = (type, { money, mode = ModeEnum.Pay }) => {
	switch (type) {
		case StepStatusEnum.Free: return {
			type: StemTypeEnum.Active,
			status: "pedding",
			pedding: locales.getText("page.eftpos-pay.text.wait")(money || "", mode),
			resolve: "",
			index: type,
			peddingStyle: {}
		};
		case StepStatusEnum.Card: return {
			type: StemTypeEnum.Active,
			status: "pedding",
			pedding: locales.getText("page.eftpos-pay.text.card"),
			resolve: "",
			index: type,
			peddingStyle: {}
		};
		case StepStatusEnum.Account: return {
			type: StemTypeEnum.Active,
			status: "pedding",
			pedding: locales.getText("page.eftpos-pay.text.account"),
			resolve: "",
			index: type,
			peddingStyle: {}
		};
		case StepStatusEnum.Application: return {
			type: StemTypeEnum.Active,
			status: "pedding",
			pedding: locales.getText("page.eftpos-pay.text.application"),
			resolve: "",
			index: type,
			peddingStyle: {}
		};
		case StepStatusEnum.Pin: return {
			type: StemTypeEnum.Active,
			status: "pedding",
			pedding: locales.getText("page.eftpos-pay.text.pin"),
			resolve: "",
			index: type,
			peddingStyle: {}
		};
		case StepStatusEnum.Processing: return {
			type: StemTypeEnum.Active,
			status: "pedding",
			pedding: locales.getText("page.eftpos-pay.text.transaction.processing"),
			resolve: "",
			index: type,
			peddingStyle: {}
		};
		case StepStatusEnum.Receipt: return {
			type: StemTypeEnum.Passive,
			status: "pedding",
			pedding: `${locales.getText("page.eftpos-pay.text.receipt.again.title")}\n${locales.getText("page.eftpos-pay.text.receipt.again.text")}`,
			resolve: locales.getText("page.eftpos-pay.text.receipt.again.title"),
			reject: locales.getText("page.eftpos-pay.text.receipt.again.title"),
			index: type,
			peddingStyle: {}
		};
		case StepStatusEnum.Wait: return {
			type: StemTypeEnum.Active,
			status: "pedding",
			pedding: locales.getText("page.eftpos-pay.text.waiting.processing"),
			resolve: locales.getText("page.eftpos-pay.text.approved"),
			index: type,
			peddingStyle: {}
		};
		default: return null;
	}
};
//#endregion
export { StemTypeEnum, StepStatusEnum, const_default as default, getStepMapping };
