<?php namespace App\Services\ServiceResponse;



use App\Utils\ResponseAbstract\ResponseBuilderAbstract;

class ServiceResponseBuilder extends ResponseBuilderAbstract
{
    public function setStatus(int $status): ServiceResponseBuilder
    {
        $this->status = $status;
        return $this;
    }

    public function setData($data): ServiceResponseBuilder
    {
        $this->data = $data;
        return $this;
    }

    public function setErrors(?array $errors): ServiceResponseBuilder
    {
        $this->errors = $errors;
        return $this;
    }

    public function build() : ServiceResponse
    {
        $service_response = new ServiceResponse();
        if (isset($this->status)) {
            $service_response->setstatus($this->status);
        }
        if (isset($this->data)) {
            $service_response->setdata($this->data);
        }
        if (isset($this->errors)) {
            $service_response->seterrors($this->errors);
        }
        return $service_response;
    }
}