import { Download } from "lucide-react"
import Link from "next/link"

import { Button } from "@/components/ui/button"
import { CategoryService } from "@/services/category.service"

import ImportForm from "./_components/import.form"

export default async function ImportPage() {
  const categories = await CategoryService.findAllWithItemsCount()
  return (
    <div className="flex flex-col gap-4">
      <div className="flex items-center justify-between gap-4">
        <h1 className="text-2xl font-bold">Mass Import</h1>
      </div>
      <div className="flex items-center justify-end gap-4">
        <Link href="/template.csv" download>
          <Button variant="outline">
            <Download />
            Download Template
          </Button>
        </Link>
      </div>
      <ImportForm categories={categories} />
    </div>
  )
}
