20 lines
531 B
TypeScript
20 lines
531 B
TypeScript
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
|
|
|
export class TrackShortName {
|
|
private constructor(private readonly value: string) {}
|
|
|
|
static create(value: string): TrackShortName {
|
|
if (!value || value.trim().length === 0) {
|
|
throw new RacingDomainValidationError('Track short name is required');
|
|
}
|
|
return new TrackShortName(value.trim());
|
|
}
|
|
|
|
toString(): string {
|
|
return this.value;
|
|
}
|
|
|
|
equals(other: TrackShortName): boolean {
|
|
return this.value === other.value;
|
|
}
|
|
} |