<?php

declare( strict_types=1 );

namespace Brightfern\Validation;

/**
 * Outcome of a VIES VAT validation.
 *
 *  status VALID   — VIES confirmed the number is active.
 *  status INVALID — VIES confirmed the number is NOT valid.
 *  status UNKNOWN — VIES was unreachable / rate-limited / non-EU number. We must
 *                   NOT block a send purely because VIES is down.
 */
final class PartyValidationResult {
	public const VALID   = 'valid';
	public const INVALID = 'invalid';
	public const UNKNOWN = 'unknown';

	public function __construct(
		public string $status,
		public string $vatNumber,
		public string $name = '',
		public string $address = '',
		public string $error = '',
	) {}

	public function isValid(): bool {
		return self::VALID === $this->status;
	}

	public function isInvalid(): bool {
		return self::INVALID === $this->status;
	}
}
