21 lines
546 B
TypeScript
21 lines
546 B
TypeScript
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
|
|
|
export class DefenseStatement {
|
|
private constructor(private readonly value: string) {}
|
|
|
|
static create(value: string): DefenseStatement {
|
|
const trimmed = value.trim();
|
|
if (!trimmed) {
|
|
throw new RacingDomainValidationError('Defense statement cannot be empty');
|
|
}
|
|
return new DefenseStatement(trimmed);
|
|
}
|
|
|
|
toString(): string {
|
|
return this.value;
|
|
}
|
|
|
|
equals(other: DefenseStatement): boolean {
|
|
return this.value === other.value;
|
|
}
|
|
} |