import { Pipe, PipeTransform } from '@angular/core';
import { ENROLLMENT_LIMITS } from '@core/constants';

/**
 * Formats credits display with max value.
 *
 * @example
 * {{ student.totalCredits | credits }}  // "6/9 créditos"
 * {{ 5 | credits:10 }}                  // "5/10 créditos"
 */
@Pipe({
  name: 'credits',
  standalone: true,
})
export class CreditsPipe implements PipeTransform {
  transform(value: number, maxCredits: number = ENROLLMENT_LIMITS.MAX_CREDITS): string {
    return `${value}/${maxCredits} créditos`;
  }
}
