<?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\LinkDescription;
use PaypalServerSdkLib\Models\Subscription;
use PaypalServerSdkLib\Models\SubscriptionCollection;

/**
 * Builder for model SubscriptionCollection
 *
 * @see SubscriptionCollection
 */
class SubscriptionCollectionBuilder
{
    /**
     * @var SubscriptionCollection
     */
    private $instance;

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

    /**
     * Initializes a new Subscription Collection Builder object.
     */
    public static function init(): self
    {
        return new self(new SubscriptionCollection());
    }

    /**
     * Sets subscriptions field.
     *
     * @param Subscription[]|null $value
     */
    public function subscriptions(?array $value): self
    {
        $this->instance->setSubscriptions($value);
        return $this;
    }

    /**
     * Sets links field.
     *
     * @param LinkDescription[]|null $value
     */
    public function links(?array $value): self
    {
        $this->instance->setLinks($value);
        return $this;
    }

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