import { RacingDomainValidationError } from '../../errors/RacingDomainError';

export class PenaltyNotes {
  private constructor(private readonly value: string) {}

  static create(value: string): PenaltyNotes {
    const trimmed = value.trim();
    if (!trimmed) {
      throw new RacingDomainValidationError('Penalty notes cannot be empty');
    }
    return new PenaltyNotes(trimmed);
  }

  toString(): string {
    return this.value;
  }

  equals(other: PenaltyNotes): boolean {
    return this.value === other.value;
  }
}