import React from 'react';

interface DataSectionProps {
  title?: string;
  subtitle?: string;
  actions?: React.ReactNode;
  divider?: 'top' | 'bottom' | 'both' | 'none';
  children: React.ReactNode;
  padding?: 'none' | 'sm' | 'md';
}

export const DataSection: React.FC<DataSectionProps> = ({
  title,
  subtitle,
  actions,
  divider = 'none',
  children,
  padding = 'md',
}) => {
  const paddingClasses = {
    none: '',
    sm: 'py-2',
    md: 'py-4',
  };

  const dividerClasses = {
    top: 'border-t border-term-border-subtle',
    bottom: 'border-b border-term-border-subtle',
    both: 'border-t border-b border-term-border-subtle',
    none: '',
  };

  return (
    <section className={`${paddingClasses[padding]} ${dividerClasses[divider]}`}>
      {(title || subtitle || actions) && (
        <div className="flex items-start justify-between mb-4">
          <div>
            {title && <h3 className="text-heading-lg text-term-text">{title}</h3>}
            {subtitle && <p className="mt-1 text-body-xs text-term-text-muted">{subtitle}</p>}
          </div>
          {actions && <div>{actions}</div>}
        </div>
      )}
      {children}
    </section>
  );
};
