import {
  AlertDialog,
  AlertDialogAction,
  AlertDialogCancel,
  AlertDialogContent,
  AlertDialogDescription,
  AlertDialogFooter,
  AlertDialogHeader,
  AlertDialogTitle,
  AlertDialogTrigger,
  Button,
} from "@/ui";
import { IGetQuote_Response_DTO } from "@shared/contexts";
import { t } from "i18next";
import { SendIcon } from "lucide-react";

export const QuoteSentToEditor = ({
  quote,
  onSentTo,
}: {
  quote: IGetQuote_Response_DTO;
  onSentTo: (quoteId: string) => void;
}) => {
  const handleSentTo = () => {
    onSentTo(quote.id);
  };

  return (
    <AlertDialog>
      <AlertDialogTrigger asChild>
        <Button size='sm' variant='default' className='h-8 gap-1'>
          <SendIcon className='h-3.5 w-3.5' />
          {t("quotes.quote_sent_to_editor.trigger_button")}
        </Button>
      </AlertDialogTrigger>
      <AlertDialogContent>
        <AlertDialogHeader>
          <AlertDialogTitle>{t("quotes.quote_sent_to_editor.title")}</AlertDialogTitle>
          <AlertDialogDescription>
            {t("quotes.quote_sent_to_editor.description")}
          </AlertDialogDescription>
        </AlertDialogHeader>
        <AlertDialogFooter>
          <AlertDialogCancel>{t("common.cancel")}</AlertDialogCancel>
          <AlertDialogAction asChild>
            <Button onClick={handleSentTo}>{t("common.continue")}</Button>
          </AlertDialogAction>
        </AlertDialogFooter>
      </AlertDialogContent>
    </AlertDialog>
  );
};
