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

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

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

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

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