import React from 'react';
import { LucideIcon } from 'lucide-react';
import { StatusBadge as UIStatusBadge } from '@/ui/StatusBadge';

interface StatusBadgeProps {
  status: string;
  config?: {
    icon: LucideIcon;
    color: string;
    bg: string;
    border: string;
    label: string;
  };
  className?: string;
}

export const StatusBadge = ({ status, config, className = '' }: StatusBadgeProps) => {
  const defaultConfig = {
    scheduled: {
      icon: undefined,
      variant: 'info' as const,
      label: 'Scheduled',
    },
    running: {
      icon: undefined,
      variant: 'success' as const,
      label: 'LIVE',
    },
    completed: {
      icon: undefined,
      variant: 'neutral' as const,
      label: 'Completed',
    },
    cancelled: {
      icon: undefined,
      variant: 'warning' as const,
      label: 'Cancelled',
    },
  };

  const badgeConfig = config 
    ? { ...config, variant: 'info' as const } // Fallback variant if config is provided
    : defaultConfig[status as keyof typeof defaultConfig] || {
        icon: undefined,
        variant: 'neutral' as const,
        label: status,
      };

  return (
    <UIStatusBadge 
      variant={badgeConfig.variant} 
      icon={badgeConfig.icon}
      className={className}
    >
      {badgeConfig.label}
    </UIStatusBadge>
  );
};