<?php
namespace Podeli\Payment\Methods;

use Podeli\Payment\Models\Order;
use Podeli\Payment\Models\ClientInfo;

class Create extends BaseMethod
{
    private ?Order $order = null;
    private ?ClientInfo $clientInfo = null;
    private ?string $notificationUrl = null;
    private ?string $failUrl = null;
    private ?string $successUrl = null;

    const HTTP_METHOD = 'POST';

    const PATH = 'create';

    public function getPath()
    {
        return static::PATH;
    }

    public function setOrder(Order $order)
    {
        $this->order = $order;
        return $this;
    }

    public function getOrder(): array
    {
        return $this->order->toArray();
    }

    public function setClientInfo(ClientInfo $clientInfo)
    {
        $this->clientInfo = $clientInfo;
        return $this;
    }

    public function setNotificationUrl(string $notificationUrl)
    {
        $this->notificationUrl = $notificationUrl;
        return $this;
    }

    public function setSuccessUrl(string $successUrl)
    {
        $this->successUrl = $successUrl;
        return $this;
    }

    public function setFailUrl(string $failUrl)
    {
        $this->failUrl = $failUrl;
        return $this;
    }

    public function getData()
    {
        $data = [
            'order' => $this->order->toArray(),
            'clientInfo' => $this->clientInfo->toArray(),
            'notificationUrl' => $this->notificationUrl,
            'failUrl' => $this->failUrl,
            'successUrl' => $this->successUrl,
        ];

        return $data;
    }
}
