import { useI18n } from '../i18n/context';

const BASE = import.meta.env.BASE_URL || '/';
const logoImg = `${BASE}logo.png`;

interface PrintHeaderProps {
  subtitle?: string;
}

function PrintHeader({ subtitle }: PrintHeaderProps) {
  const { t } = useI18n();
  const now = new Date();
  const dateStr = now.toLocaleDateString('fr-FR', { day: '2-digit', month: '2-digit', year: 'numeric', hour: '2-digit', minute: '2-digit' });

  return (
    <div className="print-header">
      <img src={logoImg} alt="Logo" />
      <span className="print-title">PROSERVE Report</span>
      {subtitle && <span style={{ color: '#333', fontSize: '0.9rem' }}>— {subtitle}</span>}
      <span className="print-subtitle">{t('print.generatedOn')} {dateStr}</span>
    </div>
  );
}

export default PrintHeader;
