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