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

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

  static create(value: string): Manufacturer {
    if (!value || value.trim().length === 0) {
      throw new RacingDomainValidationError('Manufacturer cannot be empty');
    }
    if (value.length > 50) {
      throw new RacingDomainValidationError('Manufacturer cannot exceed 50 characters');
    }
    return new Manufacturer(value.trim());
  }

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

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