"use client"

import { Plus } from "lucide-react"
import { useTranslations } from "next-intl"

import { Badge } from "@/shared/components/ui/badge"
import { Button } from "@/shared/components/ui/button"

type SchoolListToolbarProps = {
  count: number
  onCreate: () => void
  isWorking: boolean
}

/**
 * 学校列表工具栏。
 *
 * 展示学校数量 Badge 与「新建学校」按钮，按钮在任意对话框打开期间禁用。
 */
export function SchoolListToolbar({
  count,
  onCreate,
  isWorking,
}: SchoolListToolbarProps) {
  const t = useTranslations("school")

  return (
    <div className="flex items-center justify-between">
      <div className="flex items-center gap-2">
        <span className="text-base font-medium">{t("schools.all")}</span>
        <Badge variant="secondary" className="tabular-nums">
          {count}
        </Badge>
      </div>
      <Button onClick={onCreate} disabled={isWorking}>
        <Plus className="mr-2 h-4 w-4" />
        {t("schools.new")}
      </Button>
    </div>
  )
}
