<?php

namespace App\Service;

use App\Integrations\Majestic\ReportHandler;
use App\Integrations\Majestic\Request;

final class TrustFlowChecker implements StatCheckerInterface
{
    private $symbol = 'TF';
    /**
     * @var ReportHandler
     */
    private $handler;

    public function __construct(ReportHandler $handler)
    {
        $this->handler = $handler;
    }

    public function check($domain)
    {
        $response = $this->handler->report(Request::from($domain));

        return new StatResponse($domain, $this->getSymbol(), $response->getTf());
    }

    /**
     * @return string
     */
    public function getSymbol(): string
    {
        return $this->symbol;
    }
}
