"use client"

import { useLanguage } from "@/hooks/use-language"
import { Card, CardContent } from "@/components/ui/card"
import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button"
import { mockInvoices } from "@/lib/mock-data"
import { Download, FileText } from "lucide-react"

export default function BillingPage() {
  const { t } = useLanguage()

  return (
    <div className="space-y-6">
      <div>
        <h2 className="text-2xl font-bold tracking-tight">{t("invoices")}</h2>
        <p className="text-sm text-slate-500">View and download your invoices</p>
      </div>

      <Card>
        <CardContent className="p-0">
          <div className="overflow-x-auto">
            <table className="w-full text-sm">
              <thead>
                <tr className="border-b border-slate-200 bg-slate-50 text-left text-xs font-medium uppercase tracking-wider text-slate-500 dark:border-slate-800 dark:bg-slate-900">
                  <th className="px-6 py-3">{t("invoiceNo")}</th>
                  <th className="px-6 py-3">{t("amount")}</th>
                  <th className="px-6 py-3">Issued</th>
                  <th className="px-6 py-3">{t("dueDate")}</th>
                  <th className="px-6 py-3">{t("status")}</th>
                  <th className="px-6 py-3">{t("actions")}</th>
                </tr>
              </thead>
              <tbody className="divide-y divide-slate-100 dark:divide-slate-800">
                {mockInvoices.map((inv) => (
                  <tr key={inv.id} className="hover:bg-slate-50 dark:hover:bg-slate-900/50">
                    <td className="px-6 py-4">
                      <div className="flex items-center gap-2">
                        <FileText className="h-4 w-4 text-slate-400" />
                        <span className="font-mono text-xs">{inv.invoiceNo}</span>
                      </div>
                    </td>
                    <td className="px-6 py-4 font-semibold">
                      ৳ {inv.amount.toLocaleString()}
                    </td>
                    <td className="px-6 py-4 text-slate-500">{inv.issuedDate}</td>
                    <td className="px-6 py-4 text-slate-500">{inv.dueDate}</td>
                    <td className="px-6 py-4">
                      <Badge variant={inv.status === "paid" ? "success" : "warning"}>
                        {inv.status}
                      </Badge>
                    </td>
                    <td className="px-6 py-4">
                      <Button variant="ghost" size="sm" className="gap-1.5">
                        <Download className="h-3.5 w-3.5" />
                        {t("download")}
                      </Button>
                    </td>
                  </tr>
                ))}
              </tbody>
            </table>
          </div>
        </CardContent>
      </Card>
    </div>
  )
}
