<?php

declare(strict_types=1);

namespace LidonationDevs\ADAPAYFWC\Integrations\AdaUsdExchange\Requests;

use Saloon\Enums\Method;
use Saloon\Http\Request;

class CoinapiGetQuoteRequest extends Request
{
    /**
     * The HTTP method of the request
     */
    protected Method $method = Method::GET;

    public $settings;

    public function __construct(protected string $base, protected string $quote)
    {
        $this->settings = get_option('woocommerce_ada_payment_settings');
    }

    public function defaultHeaders(): array
    {

        return [
            'X-CoinAPI-Key' => !!$this->settings ? $this->settings['coinApiKey'] : null,
        ];
    }

    /**
     * The endpoint for the request
     */
    public function resolveEndpoint(): string
    {
        return 'https://rest.coinapi.io/v1/exchangerate/' . $this->base . '/' . $this->quote;
    }
}
