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