import { Badge } from '../ui/Badge';
import type { BookingStatus } from '../../types/rental';

interface BookingStatusBadgeProps {
  status: BookingStatus;
}

const statusConfig: Record<BookingStatus, { variant: 'default' | 'success' | 'warning' | 'error' | 'info'; label: string }> = {
  PENDING: { variant: 'warning', label: 'Pending' },
  CONFIRMED: { variant: 'info', label: 'Confirmed' },
  ACTIVE: { variant: 'success', label: 'Active' },
  COMPLETED: { variant: 'success', label: 'Completed' },
  CANCELLED_BY_TENANT: { variant: 'error', label: 'Cancelled by Tenant' },
  CANCELLED_BY_LANDLORD: { variant: 'error', label: 'Cancelled by Landlord' },
  REJECTED: { variant: 'error', label: 'Rejected' },
  EXPIRED: { variant: 'default', label: 'Expired' },
};

export function BookingStatusBadge({ status }: BookingStatusBadgeProps) {
  const config = statusConfig[status];

  return (
    <Badge variant={config.variant}>{config.label}</Badge>
  );
}
