import type { ForgeFieldMeta } from '../../help/forgeRules';
import { forgeBadgeLabel } from '../../help/forgeRules';

interface ForgeLockedHintProps {
  meta?: ForgeFieldMeta;
}

export function ForgeLockedHint({ meta }: ForgeLockedHintProps) {
  if (!meta?.lockedReason && !meta?.hint) return null;
  return (
    <p className="forge-locked-hint" title={meta.lockedReason || meta.hint}>
      🔒 {meta.lockedReason || meta.hint}
    </p>
  );
}

interface ForgeFieldBadgeProps {
  meta?: ForgeFieldMeta;
}

export function ForgeFieldBadge({ meta }: ForgeFieldBadgeProps) {
  if (!meta?.badge) return null;
  return (
    <span className={`forge-field-badge forge-badge-${meta.badge}`} title={forgeBadgeLabel(meta.badge)}>
      {meta.badge === 'baked' ? '⛏ baked' : meta.badge === 'server-only' ? '🖥 server' : '↳ if enabled'}
    </span>
  );
}

interface ForgeSectionHeaderProps {
  title: string;
  description: string;
  badge: 'baked' | 'server-only';
}

export function ForgeSectionHeader({ title, description, badge }: ForgeSectionHeaderProps) {
  return (
    <div className="forge-section-header">
      <div className="forge-section-title-row">
        <h3>{title}</h3>
        <span className={`forge-field-badge forge-badge-${badge}`}>{forgeBadgeLabel(badge)}</span>
      </div>
      <p className="form-hint forge-section-desc">{description}</p>
    </div>
  );
}
