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

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

  static create(value: string): CarId {
    if (!value || value.trim().length === 0) {
      throw new RacingDomainValidationError('Car ID cannot be empty');
    }
    return new CarId(value.trim());
  }

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

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