<?php

namespace App\Integrations\Semrush\Requests;

use App\Integrations\Common\Configurable;

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

    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');
    }

    public function setProjectId(string $projectId)
    {
        $this->setOption('projectId', $projectId);

        return $this;
    }

    public function setProjectName(string $projectName)
    {
        $this->setOption('projectName', $projectName);

        return $this;
    }

    public function setProjectUrl(string $url)
    {
        $this->setOption('projectUrl', $url);

        return $this;
    }

    public function getBody()
    {
        return [
            'project_id' => $this->getOption('projectId'),
            'project_name' => $this->getOption('projectName'),
            'url' => $this->getOption('projectUrl'),
        ];
    }
}
