<?php

namespace App\Integrations\Semrush\Requests;

use App\Integrations\Common\Configurable;

final class CreateCampaignRequest extends Configurable implements RequestInterface
{
    protected $options = [
        'url' => 'https://api.semrush.com/management/v1/projects',
        'method' => 'POST',
    ];

    public function __construct()
    {
        parent::__construct();
    }

    /**
     * @return string
     */
    public function getMethod(): string
    {
        return $this->getOption('method');
    }

    public function getUri()
    {
        return $this->getOption('url')
            .'?key='
            .$this->getOption('key');
    }

    /**
     * @param $title
     * @param $url
     *
     * @return $this
     */
    public function setBody($title, $url): self
    {
        $this->setOption('body', ['project_name' => $title, 'url' => $url]);

        return $this;
    }

    public function getBody()
    {
        return $this->getOption('body');
    }
}
