import { RacingDomainValidationError } from '../errors/RacingDomainError';

export class VideoUrl {
  private constructor(private readonly value: string) {}

  static create(value: string): VideoUrl {
    if (!value || value.trim().length === 0) {
      throw new RacingDomainValidationError('Video URL cannot be empty');
    }
    // Basic URL validation
    try {
      new URL(value);
    } catch {
      throw new RacingDomainValidationError('Invalid video URL format');
    }
    return new VideoUrl(value.trim());
  }

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

  equals(other: VideoUrl): boolean {
    return this.value === other.value;
  }
}