import { RacingDomainValidationError } from '../errors/RacingDomainError';
import type { IValueObject } from '@core/shared/domain';

export interface LeagueTimezoneProps {
  id: string;
}

export class LeagueTimezone implements IValueObject<LeagueTimezoneProps> {
  readonly id: string;

  private constructor(id: string) {
    this.id = id;
  }

  static create(id: string): LeagueTimezone {
    if (!id || id.trim().length === 0) {
      throw new RacingDomainValidationError('LeagueTimezone id must be a non-empty string');
    }
    return new LeagueTimezone(id.trim());
  }

  get props(): LeagueTimezoneProps {
    return { id: this.id };
  }

  toString(): string {
    return this.id;
  }

  equals(other: IValueObject<LeagueTimezoneProps>): boolean {
    return this.props.id === other.props.id;
  }
}