<?php

namespace PostenBringCheckout\admin\api\models;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

interface VerificationResult {
	public function isInvalid();
}

/**
 * Object holding verification results of the credentials
 */
class CredentialsVerificationResult implements VerificationResult {
	public $validCredentials;
	public $validWebshopId;
	public $accessToWebshop;

	/**
	 * @param bool $validCredentials
	 * @param bool $validWebshopId
	 * @param bool $accessToWebshop
	 */
	public function __construct( bool $validCredentials, bool $validWebshopId, bool $accessToWebshop ) {
		$this->validCredentials = $validCredentials;
		$this->validWebshopId   = $validWebshopId;
		$this->accessToWebshop  = $accessToWebshop;
	}

	/**
	 * @return bool
	 */
	public function isInvalid(): bool {
		return ! $this->validCredentials || ! $this->validWebshopId || ! $this->accessToWebshop;
	}

	public static function valid(): CredentialsVerificationResult {
		return new self( true, true, true );
	}
}
