import { RacingDomainValidationError } from '../errors/RacingDomainError'; import type { IValueObject } from '@core/shared/domain'; export class CountryCode implements IValueObject { private constructor(private readonly value: string) {} static create(value: string): CountryCode { if (!value || value.trim().length === 0) { throw new RacingDomainValidationError('Country code is required'); } const trimmed = value.trim().toUpperCase(); if (!/^[A-Z]{2,3}$/.test(trimmed)) { throw new RacingDomainValidationError('Country must be a valid ISO code (2-3 letters)'); } return new CountryCode(trimmed); } toString(): string { return this.value; } equals(other: IValueObject): boolean { return this.value === other.props; } get props(): string { return this.value; } }