import { jsxs as o, jsx as e } from "react/jsx-runtime";
import "react";
import { useForm as S, Controller as g } from "react-hook-form";
import * as m from "yup";
import { yupResolver as C } from "@hookform/resolvers/yup";
import { FormControl as b, Typography as p, Select as E, MenuItem as a, Box as T, Button as d } from "@mui/material";
import u from "prop-types";
import "./ManageEventConfiguration-BJxS2Su0.js";
import { useTranslateProvider as F } from "@/common/languageTranslator/TranslationContext";
import h from "@/common/services/util/GeneralUtil";
const I = ({ setType: i, onSubmit: y }) => {
  var l;
  const { translate: t } = F(), f = m.object().shape({
    type: m.string().required("Type is Required")
  }), {
    control: x,
    handleSubmit: N,
    reset: n,
    formState: { errors: r }
  } = S({
    resolver: C(f),
    mode: "onChange"
  }), v = () => {
    y(), n(), i(null);
  };
  return /* @__PURE__ */ o("div", { children: [
    /* @__PURE__ */ o(
      b,
      {
        fullWidth: !0,
        error: !!r.type,
        className: "mb-2",
        "data-testid": "typeconfigurationform-formcontrol-type",
        children: [
          /* @__PURE__ */ o(p, { variant: "body2", className: "m-1", children: [
            t("Type"),
            /* @__PURE__ */ e("span", { className: "text-red-500 ml-1", children: "*" })
          ] }),
          /* @__PURE__ */ e(
            g,
            {
              name: "type",
              control: x,
              defaultValue: "",
              render: ({ field: c }) => /* @__PURE__ */ o(
                E,
                {
                  ...c,
                  size: "small",
                  displayEmpty: !0,
                  onChange: (s) => {
                    c.onChange(s.target.value), i(s.target.value);
                  },
                  "data-testid": "typeconfigurationform-select-type",
                  children: [
                    /* @__PURE__ */ e(a, { value: "", children: /* @__PURE__ */ e(p, { variant: "body2", children: t("Select") }) }),
                    /* @__PURE__ */ e(a, { className: "text-[14px] ", value: "SMS", children: t("SMS Notification") }),
                    /* @__PURE__ */ e(a, { className: "text-[14px]", value: "EMAIL", children: t("Email Notification") }),
                    /* @__PURE__ */ e(a, { className: "text-[14px]", value: "QUERY", children: t("Query") }),
                    /* @__PURE__ */ e(a, { className: "text-[14px]", value: "MOBILE", children: t("Mobile Notification") }),
                    /* @__PURE__ */ e(a, { className: "text-[14px]", value: "EXCEPTION", children: t("Exception") }),
                    /* @__PURE__ */ e(a, { className: "text-[14px]", value: "SYSTEM_FUNCTION", children: t("System Function") }),
                    /* @__PURE__ */ e(a, { className: "text-[14px]", value: "PUSH_NOTIFICATION", children: t("Push Notification") }),
                    (h.isEkavach || h.isPhmp) && /* @__PURE__ */ e(a, { className: "text-[14px]", value: "KAFKA_SYNC", children: t("Kafka Sync") })
                  ]
                }
              )
            }
          ),
          (r == null ? void 0 : r.type) && /* @__PURE__ */ e(
            "p",
            {
              className: "error-helper",
              "data-testid": "typeconfigurationform-error-helper-type",
              children: (l = r == null ? void 0 : r.type) == null ? void 0 : l.message
            }
          )
        ]
      }
    ),
    /* @__PURE__ */ o(T, { className: "flex items-center gap-1", children: [
      /* @__PURE__ */ e(
        d,
        {
          type: "button",
          variant: "outlined",
          color: "secondary",
          onClick: () => {
            i(null), n(), i(null);
          },
          "data-testid": "typeconfigurationform-button-clear",
          children: t("Clear")
        }
      ),
      /* @__PURE__ */ e(
        d,
        {
          variant: "contained",
          color: "primary",
          onClick: N(v),
          "data-testid": "typeconfigurationform-button-add",
          children: t("Add")
        }
      )
    ] })
  ] });
};
I.propTypes = {
  setType: u.any,
  // or PropTypes.shape({...}) for specific shape
  onSubmit: u.any
  // or PropTypes.shape({...}) for specific shape
};
export {
  I as default
};
//# sourceMappingURL=TypeConfiguration-C-lk8Szs.js.map
