import FormShell from "@/components/app/FormShell"
import PageHeader from "@/components/app/PageHeader"
import PageShell from "@/components/app/PageShell"
import { Button } from "@/components/ui/button"
import DepartmentForm from "@/features/departments/components/DepartmentForm"
import { db } from "@/lib/db"

export default async function CreateDepartmentPage() {
  const branches = await db.branch.findMany({
    select: { id: true, name: true },
    orderBy: { name: "asc" },
  })

  return (
    <PageShell>
      <PageHeader
        title="Add Department"
        actions={
          <Button asChild variant="secondary">
            <a href="/departments">Back</a>
          </Button>
        }
      />
      <FormShell>
        <DepartmentForm branches={branches} />
      </FormShell>
    </PageShell>
  )
}