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

export class Horsepower {
  private constructor(private readonly value: number) {}

  static create(value: number): Horsepower {
    if (value <= 0) {
      throw new RacingDomainValidationError('Horsepower must be positive');
    }
    return new Horsepower(value);
  }

  toNumber(): number {
    return this.value;
  }

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