import { Badge } from "@/components/ui/badge"
import { AdjustmentStatus, CountStatus, TransferStatus } from "@/types/stock"

// Same fixed-size, red/green/yellow convention as components/receiving/status-badges.tsx.
const badgeSize = "h-6 w-28 justify-center px-2.5 py-1 text-sm"

const warning = "bg-warning/10 text-warning border-transparent"
const success = "bg-success/10 text-success border-transparent"
const destructive = "bg-destructive/10 text-destructive border-transparent"

export function TransferStatusBadge({ status }: { status: TransferStatus }) {
  const tone = status === "Received" ? success : status === "Closed" ? destructive : warning
  return (
    <Badge variant="outline" className={`${badgeSize} ${tone}`}>
      {status}
    </Badge>
  )
}

export function CountStatusBadge({ status }: { status: CountStatus }) {
  const tone = status === "Posted" ? success : warning
  return (
    <Badge variant="outline" className={`${badgeSize} ${tone}`}>
      {status}
    </Badge>
  )
}

export function AdjustmentStatusBadge({ status }: { status: AdjustmentStatus }) {
  return (
    <Badge variant="outline" className={`${badgeSize} ${success}`}>
      {status}
    </Badge>
  )
}
