import { Modal } from "antd";
import { useTranslation } from "react-i18next";

import Content from "pages/cart/components/timeEstimate/Content.tsx";

interface EstimateTimeDialogProps {
  isOpen: boolean;
  onClose: () => void;
  onSave: (date: Date, time: string) => void;
  initialDate?: Date;
}

export function Dialog({
  isOpen,
  onClose,
  onSave,
  initialDate = new Date(),
}: EstimateTimeDialogProps) {
  const { t } = useTranslation();

  return (
    <Modal
      title={t("cart.selectTimeEstimate")}
      open={isOpen}
      onCancel={onClose}
      footer={[]}
      width={500}
      destroyOnHidden
    >
      <Content onSave={onSave} initialDate={initialDate} onClose={onClose} />
    </Modal>
  );
}
