import { RacingDomainValidationError } from '../errors/RacingDomainError';
import type { IValueObject } from '@core/shared/domain';

export class TrackShortName implements IValueObject<string> {
  private constructor(private readonly value: string) {}

  get props(): string {
    return this.value;
  }

  static create(value: string): TrackShortName {
    if (!value || value.trim().length === 0) {
      throw new RacingDomainValidationError('Track short name is required');
    }
    return new TrackShortName(value.trim());
  }

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

  equals(other: IValueObject<string>): boolean {
    return this.value === other.props;
  }
}