<?php

declare(strict_types=1);

/*
 * PaypalServerSDKLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */

namespace PaypalServerSDKLib\Models\Builders;

use Core\Utils\CoreHelper;
use PaypalServerSDKLib\Models\ErrorDetails;

/**
 * Builder for model ErrorDetails
 *
 * @see ErrorDetails
 */
class ErrorDetailsBuilder
{
    /**
     * @var ErrorDetails
     */
    private $instance;

    private function __construct(ErrorDetails $instance)
    {
        $this->instance = $instance;
    }

    /**
     * Initializes a new error details Builder object.
     */
    public static function init(string $issue): self
    {
        return new self(new ErrorDetails($issue));
    }

    /**
     * Sets field field.
     */
    public function field(?string $value): self
    {
        $this->instance->setField($value);
        return $this;
    }

    /**
     * Sets value field.
     */
    public function value(?string $value): self
    {
        $this->instance->setValue($value);
        return $this;
    }

    /**
     * Sets location field.
     */
    public function location(?string $value): self
    {
        $this->instance->setLocation($value);
        return $this;
    }

    /**
     * Sets links field.
     */
    public function links(?array $value): self
    {
        $this->instance->setLinks($value);
        return $this;
    }

    /**
     * Sets description field.
     */
    public function description(?string $value): self
    {
        $this->instance->setDescription($value);
        return $this;
    }

    /**
     * Initializes a new error details object.
     */
    public function build(): ErrorDetails
    {
        return CoreHelper::clone($this->instance);
    }
}
