<?php

namespace App\Service\Moz;

use App\Service\ExecutableInterface;

final class Client extends Configurable implements ExecutableInterface
{
    /**
     * @param string $domain
     *
     * @return mixed
     */
    public function execute(String $domain)
    {
        $request = new Request($this->getAccessId(), $this->getSecret(), $this->getExpires(), $domain);

        return $this->getAdapater()->execute($request);
    }

    private function getSecret()
    {
        return $this->getOption('secret');
    }

    private function getAccessId()
    {
        return $this->getOption('accessId');
    }

    private function getExpires()
    {
        return time() + $this->getOption('expires');
    }

    private function getAdapater()
    {
        return $this->getOption('adapter');
    }
}
