/**
 * PercentDisplay
 * 
 * Deterministic formatting for percentages.
 */

export class PercentDisplay {
  /**
   * Formats a decimal value as a percentage string.
   * Example: 0.1234 -> "12.3%"
   */
  static format(value: number | null | undefined): string {
    if (value === null || value === undefined) return '0.0%';
    return `${(value * 100).toFixed(1)}%`;
  }

  /**
   * Formats a whole number as a percentage string.
   * Example: 85 -> "85%"
   */
  static formatWhole(value: number | null | undefined): string {
    if (value === null || value === undefined) return '0%';
    return `${Math.round(value)}%`;
  }
}
