/**
 * Copyright (c) 2023-present Plane Software, Inc. and contributors
 * SPDX-License-Identifier: AGPL-3.0-only
 * See the LICENSE file for details.
 */

import { Button } from "@plane/propel/button";
import { EModalPosition, EModalWidth, ModalCore } from "@plane/ui";

type Props = {
  isOpen: boolean;
  isSubmitting?: boolean;
  issueName: string;
  onClose: () => void;
  onSubmit: () => Promise<void>;
};

export function ExternalContourDeleteModal(props: Props) {
  const { isOpen, isSubmitting = false, issueName, onClose, onSubmit } = props;

  return (
    <ModalCore
      isOpen={isOpen}
      handleClose={onClose}
      position={EModalPosition.CENTER}
      width={EModalWidth.MD}
      className="nodedc-glass-modal rounded-[1.75rem]"
    >
      <div className="space-y-5 p-6">
        <div className="space-y-1.5">
          <h3 className="text-18 font-semibold text-primary">Удалить исходящую задачу</h3>
          <p className="text-13 leading-5 text-secondary">
            Задача «{issueName}» будет удалена из внешнего контура и из целевого проекта. Это действие нельзя отменить.
          </p>
        </div>

        <div className="flex justify-end gap-2">
          <Button variant="primary" onClick={onClose} disabled={isSubmitting} className="nodedc-modal-primary-button">
            Отмена
          </Button>
          <Button variant="secondary" onClick={onSubmit} disabled={isSubmitting} className="nodedc-modal-secondary-button">
            {isSubmitting ? "Удаление..." : "Удалить"}
          </Button>
        </div>
      </div>
    </ModalCore>
  );
}
