import { _objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
//#region src/plus/saasDevice/devicePlanning/types.ts
const EMPTY_I18N = {
	original: "",
	en: "",
	"zh-CN": "",
	"zh-HK": "",
	ja: "",
	pt: ""
};
const DEVICE_KIND_OPTIONS = [
	"smart",
	"dumb",
	"integrated"
];
/** 统一把后端多语言值转成可编辑表单需要的语言字典。 */
const toLangDict = (val) => {
	if (!val) return _objectSpread2({}, EMPTY_I18N);
	if (typeof val === "string") return _objectSpread2(_objectSpread2({}, EMPTY_I18N), {}, {
		original: val,
		en: val
	});
	return _objectSpread2(_objectSpread2({}, EMPTY_I18N), val);
};
/** 校验 BaseTranslation 字段是否至少填写 original 或任一语言值。 */
const validateI18nRequired = (message) => (_rule, value) => {
	if (!value) return Promise.reject(new Error(message));
	if (typeof value === "string") return value.trim() ? Promise.resolve() : Promise.reject(new Error(message));
	const filled = Object.entries(value).some(([key, val]) => key !== "original" && typeof val === "string" && val.trim() !== "");
	const original = typeof (value === null || value === void 0 ? void 0 : value.original) === "string" && value.original.trim() !== "";
	return filled || original ? Promise.resolve() : Promise.reject(new Error(message));
};
//#endregion
export { DEVICE_KIND_OPTIONS, EMPTY_I18N, toLangDict, validateI18nRequired };
