import * as React from 'react'
import { cva, type VariantProps } from 'class-variance-authority'
import { cn } from '@/lib/utils'

const badgeVariants = cva(
  'inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium transition-colors',
  {
    variants: {
      variant: {
        default: 'bg-brand-50 text-brand-700 dark:bg-brand-900/30 dark:text-brand-300',
        secondary: 'bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-300',
        destructive: 'bg-red-50 text-red-600 dark:bg-red-900/30 dark:text-red-400',
        success: 'bg-green-50 text-green-600 dark:bg-green-900/30 dark:text-green-400',
        outline: 'border border-gray-200 text-gray-600 dark:border-gray-700 dark:text-gray-400',
      },
    },
    defaultVariants: {
      variant: 'default',
    },
  },
)

export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {}

function Badge({ className, variant, ...props }: BadgeProps) {
  return <div className={cn(badgeVariants({ variant }), className)} {...props} />
}

export { Badge, badgeVariants }
