/**
 * KRA - Warning Bar Component
 * Display warning/info messages with optional link
 */
import React from 'react';
import { Alert } from 'antd';
import { WarningOutlined, InfoCircleOutlined, CheckCircleOutlined, CloseCircleOutlined } from '@ant-design/icons';

interface WarningBarProps {
  title: string;
  type?: 'warning' | 'info' | 'success' | 'error';
  href?: string;
  showIcon?: boolean;
  closable?: boolean;
  className?: string;
  style?: React.CSSProperties;
}

const WarningBar: React.FC<WarningBarProps> = ({
  title,
  type = 'warning',
  href,
  showIcon = true,
  closable = false,
  className,
  style,
}) => {
  const handleClick = () => {
    if (href) {
      window.open(href, '_blank');
    }
  };

  return (
    <Alert
      message={title}
      type={type}
      showIcon={showIcon}
      closable={closable}
      className={className}
      style={{
        cursor: href ? 'pointer' : 'default',
        marginBottom: 12,
        ...style,
      }}
      onClick={handleClick}
    />
  );
};

export default WarningBar;
