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

21 lines
529 B
TypeScript

import { RacingDomainValidationError } from '../../errors/RacingDomainError';
export class PenaltyNotes {
private constructor(private readonly value: string) {}
static create(value: string): PenaltyNotes {
const trimmed = value.trim();
if (!trimmed) {
throw new RacingDomainValidationError('Penalty notes cannot be empty');
}
return new PenaltyNotes(trimmed);
}
toString(): string {
return this.value;
}
equals(other: PenaltyNotes): boolean {
return this.value === other.value;
}
}