const require_runtime = require("../../../../../_virtual/_rolldown/runtime.js");
const require_types = require("../../model/types.js");
let react = require("react");
react = require_runtime.__toESM(react);
let antd = require("antd");
let _pisell_materials = require("@pisell/materials");
//#region src/plus/saasDevice/devicePlanning/components/shared/DeviceBasicInfoForm.tsx
const DeviceBasicInfoForm = ({ form, selectedModel, profiles = [], profileRequired, showProfile, workAreas, workAreaId, currentWorkAreaId, getText, translation, onWorkAreaChange, onValuesChange, showSelectedModel = true }) => {
	var _selectedModel$type;
	return /* @__PURE__ */ react.default.createElement("div", {
		className: "add-device-modal__body",
		style: { minHeight: "auto" }
	}, showSelectedModel && selectedModel ? /* @__PURE__ */ react.default.createElement("div", { className: "add-device-modal__selected-model" }, /* @__PURE__ */ react.default.createElement(_pisell_materials.Icon, { type: ((_selectedModel$type = selectedModel.type) === null || _selectedModel$type === void 0 ? void 0 : _selectedModel$type.icon) || "DesktopOutlined" }), /* @__PURE__ */ react.default.createElement("div", null, /* @__PURE__ */ react.default.createElement("div", { className: "add-device-modal__model-name" }, translation(selectedModel.name) || ""), /* @__PURE__ */ react.default.createElement("div", { className: "add-device-modal__model-desc" }, translation(selectedModel.description) || ""))) : null, /* @__PURE__ */ react.default.createElement(antd.Form, {
		form,
		layout: "vertical",
		preserve: false,
		onValuesChange
	}, /* @__PURE__ */ react.default.createElement(antd.Form.Item, {
		name: "name",
		label: getText("pisell2.saas.device-planning.add.device-name"),
		required: true,
		rules: [{ validator: require_types.validateI18nRequired(getText("pisell2.saas.device-planning.add.device-name-required")) }]
	}, /* @__PURE__ */ react.default.createElement(_pisell_materials.BaseTranslation, { renderMode: "edit" })), workAreas ? /* @__PURE__ */ react.default.createElement(antd.Form.Item, {
		label: getText("pisell2.saas.device-planning.edit.work-area"),
		required: true
	}, /* @__PURE__ */ react.default.createElement(_pisell_materials.Select, {
		value: workAreaId,
		options: workAreas.map((area) => ({
			label: `${translation(area.name) || area.id}${area.id === currentWorkAreaId ? ` (${getText("pisell2.saas.device-planning.connect.current")})` : ""}`,
			value: area.id
		})),
		onChange: (value) => onWorkAreaChange === null || onWorkAreaChange === void 0 ? void 0 : onWorkAreaChange(value)
	})) : null, showProfile && profileRequired ? /* @__PURE__ */ react.default.createElement(antd.Form.Item, {
		name: "profile_id",
		label: getText("pisell2.saas.device-planning.add.device-profile"),
		required: true,
		rules: [{
			required: true,
			message: getText("pisell2.saas.device-planning.add.device-profile-required")
		}],
		help: profiles.length === 0 ? getText("pisell2.saas.device-planning.add.create-profile-first") : void 0
	}, /* @__PURE__ */ react.default.createElement(_pisell_materials.Select, {
		disabled: profiles.length === 0,
		options: profiles.map((profile) => ({
			label: translation(profile.name) || String(profile.id),
			value: profile.id
		}))
	})) : null));
};
//#endregion
exports.default = DeviceBasicInfoForm;
