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

export interface LeagueTimezoneProps {
  id: string;
}

export class LeagueTimezone implements ValueObject<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: ValueObject<LeagueTimezoneProps>): boolean {
    return this.props.id === other.props.id;
  }
}