<?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\AmountBreakdown;
use PaypalServerSDKLib\Models\Money;

/**
 * Builder for model AmountBreakdown
 *
 * @see AmountBreakdown
 */
class AmountBreakdownBuilder
{
    /**
     * @var AmountBreakdown
     */
    private $instance;

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

    /**
     * Initializes a new amount breakdown Builder object.
     */
    public static function init(): self
    {
        return new self(new AmountBreakdown());
    }

    /**
     * Sets item total field.
     */
    public function itemTotal(?Money $value): self
    {
        $this->instance->setItemTotal($value);
        return $this;
    }

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

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

    /**
     * Sets tax total field.
     */
    public function taxTotal(?Money $value): self
    {
        $this->instance->setTaxTotal($value);
        return $this;
    }

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

    /**
     * Sets shipping discount field.
     */
    public function shippingDiscount(?Money $value): self
    {
        $this->instance->setShippingDiscount($value);
        return $this;
    }

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

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