//@ts-ignore
import { Timer } from "impaktapps-design";
import { useContext } from "react";
import { getFieldName } from "../permissions/getFieldName";
import { useJsonForms } from "@jsonforms/react";
import { DataContext } from "../context/Context";
import ComponentWrapper from "../common/ComponentWrapper";
import { getComponentProps } from "../common/getComponentProps";
import React from "react";

const CustomTimer = React.memo(({ data, uischema, path ,schema,rootSchema}: any) => {
  const { pageName, permissions,theme } = useContext(DataContext);
  const fieldName = getFieldName(path);
  const ctx = useJsonForms();
  return (
    <ComponentWrapper
    {...getComponentProps(`${pageName}:${fieldName}`,permissions,schema,rootSchema)} >
      <Timer
        value={{
          data,
          uischema,
        }}
        theme={theme.myTheme}
      />
    </ComponentWrapper>
  );
});

export default CustomTimer;
