"use client"

import {
  Dialog,
  DialogContent,
  DialogHeader,
  DialogTitle,
  DialogFooter
} from "@/components/ui/dialog"

import { Button } from "@/components/ui/button"

interface Props {
  loading?: boolean
  onConfirm: () => void
  onClose: () => void
}

export default function LogoutDialog({
  loading,
  onConfirm,
  onClose
}: Props) {

  return (
    <Dialog open onOpenChange={(o) => !o && onClose()}>

      <DialogContent className="pt-8 text-center">

        <DialogHeader className="items-center">
          <DialogTitle className="text-xl font-bold text-center">
            خروج از حساب کاربری
          </DialogTitle>
        </DialogHeader>

        <p className="text-muted-foreground mt-3">
          آیا مطمئن هستید که می‌خواهید از حساب کاربری خود خارج شوید؟
        </p>

        <DialogFooter className="flex-row-reverse justify-center mt-6">

          <Button
            onClick={onConfirm}
            disabled={loading}
            variant="destructive"
            className="mx-1"
          >
            خروج
          </Button>

          <Button
            variant="outline"
            onClick={onClose}
            className="mx-1"
          >
            انصراف
          </Button>

        </DialogFooter>

      </DialogContent>

    </Dialog>
  )
}
