import React from 'react';

interface PostStatusBadgeProps {
  status: "open" | "answered" | "closed";
}

const PostStatusBadge: React.FC<PostStatusBadgeProps> = ({ status }) => {
  const getStatusConfig = (stat: string) => {
    switch (stat) {
      case 'open':
        return { label: 'Open', color: 'success', icon: 'bi-circle' };
      case 'answered':
        return { label: 'Answered', color: 'info', icon: 'bi-check-circle' };
      case 'closed':
        return { label: 'Closed', color: 'secondary', icon: 'bi-x-circle' };
      default:
        return { label: status, color: 'secondary', icon: 'bi-circle' };
    }
  };

  const config = getStatusConfig(status);

  return (
    <span className={`badge bg-${config.color}`}>
      <i className={`bi ${config.icon} me-1`}></i>
      {config.label}
    </span>
  );
};

export default PostStatusBadge;
