<?php

declare (strict_types=1);
/*
 * PaypalServerSdkLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */
namespace FormGent\PaypalServerSdkLib\Models\Builders;

use FormGent\Core\Utils\CoreHelper;
use FormGent\PaypalServerSdkLib\Models\BillingCycle;
use FormGent\PaypalServerSdkLib\Models\OneTimeCharge;
use FormGent\PaypalServerSdkLib\Models\Plan;
/**
 * Builder for model Plan
 *
 * @see Plan
 */
class PlanBuilder
{
    /**
     * @var Plan
     */
    private $instance;
    private function __construct(Plan $instance)
    {
        $this->instance = $instance;
    }
    /**
     * Initializes a new Plan Builder object.
     *
     * @param BillingCycle[] $billingCycles
     * @param OneTimeCharge $oneTimeCharges
     */
    public static function init(array $billingCycles, OneTimeCharge $oneTimeCharges) : self
    {
        return new self(new Plan($billingCycles, $oneTimeCharges));
    }
    /**
     * Sets product field.
     *
     * @param mixed $value
     */
    public function product($value) : self
    {
        $this->instance->setProduct($value);
        return $this;
    }
    /**
     * Sets name field.
     *
     * @param string|null $value
     */
    public function name(?string $value) : self
    {
        $this->instance->setName($value);
        return $this;
    }
    /**
     * Initializes a new Plan object.
     */
    public function build() : Plan
    {
        return CoreHelper::clone($this->instance);
    }
}
