Files
gridpilot.gg/core/racing/domain/entities/championship/ResultsCount.ts
2025-12-17 00:33:13 +01:00

20 lines
537 B
TypeScript

import { RacingDomainValidationError } from '../../errors/RacingDomainError';
export class ResultsCount {
private constructor(private readonly value: number) {}
static create(value: number): ResultsCount {
if (!Number.isInteger(value) || value < 0) {
throw new RacingDomainValidationError('Results count must be a non-negative integer');
}
return new ResultsCount(value);
}
toNumber(): number {
return this.value;
}
equals(other: ResultsCount): boolean {
return this.value === other.value;
}
}