20 lines
502 B
TypeScript
20 lines
502 B
TypeScript
import { RacingDomainValidationError } from '../../errors/RacingDomainError';
|
|
|
|
export class PrizeId {
|
|
private constructor(private readonly value: string) {}
|
|
|
|
static create(value: string): PrizeId {
|
|
if (!value || value.trim().length === 0) {
|
|
throw new RacingDomainValidationError('Prize ID cannot be empty');
|
|
}
|
|
return new PrizeId(value.trim());
|
|
}
|
|
|
|
toString(): string {
|
|
return this.value;
|
|
}
|
|
|
|
equals(other: PrizeId): boolean {
|
|
return this.value === other.value;
|
|
}
|
|
} |