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

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

  static create(value: string): LeagueName {
    if (!value || value.trim().length === 0) {
      throw new RacingDomainValidationError('League name cannot be empty');
    }
    if (value.length > 100) {
      throw new RacingDomainValidationError('League name cannot exceed 100 characters');
    }
    return new LeagueName(value.trim());
  }

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

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