// Pure formatting/IO helpers for the admin event detail page.

export function formatCurrency(amount: number, currency: string): string {
  if (currency === 'PYG') {
    return `${amount.toLocaleString('es-PY')} PYG`;
  }
  return `$${amount.toFixed(2)} ${currency}`;
}

/** Trigger a browser download for a blob with the given filename. */
export function downloadBlob(blob: Blob, filename: string): void {
  const url = URL.createObjectURL(blob);
  const a = document.createElement('a');
  a.href = url;
  a.download = filename;
  document.body.appendChild(a);
  a.click();
  document.body.removeChild(a);
  URL.revokeObjectURL(url);
}
