21 lines
529 B
TypeScript
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;
|
|
}
|
|
} |