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

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

  static create(value: string): IncidentDescription {
    const trimmed = value.trim();
    if (!trimmed) {
      throw new RacingDomainValidationError('Incident description cannot be empty');
    }
    return new IncidentDescription(trimmed);
  }

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

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