<?php

namespace Planaday\Utility\Debug\Checking\Checks;

use Planaday\Config\General\Api\ApiSettings;
use Planaday\Utility\Debug\Checking\Check;
use Planaday\Utility\Debug\Checking\CheckResultTypes;

class ApiUrlCheck implements Check {
	protected ?string $domain;

	public function __construct(ApiSettings $options) {
		$this->domain = $options->getDomain();
	}

	public function check( ?string &$checkMessage ): string {
		if (!empty($this->domain)){
			$checkMessage = 'De URL voor jouw API omgeving van Planaday is ingevuld!';
			return CheckResultTypes::SUCCESS;
		} else {
			$checkMessage = 'De URL voor jouw API omgeving van Planaday is niet ingevuld!';
			return CheckResultTypes::FAILED;
		}
	}
}