<?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\LastPaymentDetails;
use PaypalServerSdkLib\Models\Money;

/**
 * Builder for model LastPaymentDetails
 *
 * @see LastPaymentDetails
 */
class LastPaymentDetailsBuilder
{
    /**
     * @var LastPaymentDetails
     */
    private $instance;

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

    /**
     * Initializes a new Last Payment Details Builder object.
     */
    public static function init(): self
    {
        return new self(new LastPaymentDetails());
    }

    /**
     * Sets amount field.
     *
     * @param Money|null $value
     */
    public function amount(?Money $value): self
    {
        $this->instance->setAmount($value);
        return $this;
    }

    /**
     * Sets time field.
     *
     * @param string|null $value
     */
    public function time(?string $value): self
    {
        $this->instance->setTime($value);
        return $this;
    }

    /**
     * Initializes a new Last Payment Details object.
     */
    public function build(): LastPaymentDetails
    {
        return CoreHelper::clone($this->instance);
    }
}
