29 lines
719 B
TypeScript
29 lines
719 B
TypeScript
import { RacingDomainValidationError } from '../errors/RacingDomainError';
|
|
import type { IValueObject } from '@gridpilot/shared/domain';
|
|
|
|
export interface LeagueTimezoneProps {
|
|
id: string;
|
|
}
|
|
|
|
export class LeagueTimezone implements IValueObject<LeagueTimezoneProps> {
|
|
private readonly id: string;
|
|
|
|
constructor(id: string) {
|
|
if (!id || id.trim().length === 0) {
|
|
throw new RacingDomainValidationError('LeagueTimezone id must be a non-empty string');
|
|
}
|
|
this.id = id;
|
|
}
|
|
|
|
getId(): string {
|
|
return this.id;
|
|
}
|
|
|
|
get props(): LeagueTimezoneProps {
|
|
return { id: this.id };
|
|
}
|
|
|
|
equals(other: IValueObject<LeagueTimezoneProps>): boolean {
|
|
return this.props.id === other.props.id;
|
|
}
|
|
} |