<?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 ApiKeyCheck implements Check {
	protected ?string $key;

	public function __construct(ApiSettings $options) {
		$this->key = $options->getApiKey();
	}

	public function check( ?string &$checkMessage ): string {
		if (!empty($this->key)){
			$checkMessage = 'API Key voor Planaday is ingevuld!';
			return CheckResultTypes::SUCCESS;
		} else {
			$checkMessage = 'De API Key voor Planaday is niet ingevuld, haal deze op in jouw Planaday omgeving bij "beheer -> publieke apikeys"';
			return CheckResultTypes::FAILED;
		}
	}
}