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

/**
 * Builder for model PlatformFee
 *
 * @see PlatformFee
 */
class PlatformFeeBuilder
{
    /**
     * @var PlatformFee
     */
    private $instance;

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

    /**
     * Initializes a new platform fee Builder object.
     */
    public static function init(Money $amount): self
    {
        return new self(new PlatformFee($amount));
    }

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

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