All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.squareup.square.legacy.models.PaymentLinkRelatedResources Maven / Gradle / Ivy

There is a newer version: 44.2.0.20250521
Show newest version
package com.squareup.square.legacy.models;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonGetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.apimatic.core.types.OptionalNullable;
import java.util.List;
import java.util.Objects;

/**
 * This is a model class for PaymentLinkRelatedResources type.
 */
public class PaymentLinkRelatedResources {
    private final OptionalNullable> orders;
    private final OptionalNullable> subscriptionPlans;

    /**
     * Initialization constructor.
     * @param  orders  List of Order value for orders.
     * @param  subscriptionPlans  List of CatalogObject value for subscriptionPlans.
     */
    @JsonCreator
    public PaymentLinkRelatedResources(
            @JsonProperty("orders") List orders,
            @JsonProperty("subscription_plans") List subscriptionPlans) {
        this.orders = OptionalNullable.of(orders);
        this.subscriptionPlans = OptionalNullable.of(subscriptionPlans);
    }

    /**
     * Initialization constructor.
     * @param  orders  List of Order value for orders.
     * @param  subscriptionPlans  List of CatalogObject value for subscriptionPlans.
     */
    protected PaymentLinkRelatedResources(
            OptionalNullable> orders, OptionalNullable> subscriptionPlans) {
        this.orders = orders;
        this.subscriptionPlans = subscriptionPlans;
    }

    /**
     * Internal Getter for Orders.
     * The order associated with the payment link.
     * @return Returns the Internal List of Order
     */
    @JsonGetter("orders")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonSerialize(using = OptionalNullable.Serializer.class)
    protected OptionalNullable> internalGetOrders() {
        return this.orders;
    }

    /**
     * Getter for Orders.
     * The order associated with the payment link.
     * @return Returns the List of Order
     */
    @JsonIgnore
    public List getOrders() {
        return OptionalNullable.getFrom(orders);
    }

    /**
     * Internal Getter for SubscriptionPlans.
     * The subscription plan associated with the payment link.
     * @return Returns the Internal List of CatalogObject
     */
    @JsonGetter("subscription_plans")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonSerialize(using = OptionalNullable.Serializer.class)
    protected OptionalNullable> internalGetSubscriptionPlans() {
        return this.subscriptionPlans;
    }

    /**
     * Getter for SubscriptionPlans.
     * The subscription plan associated with the payment link.
     * @return Returns the List of CatalogObject
     */
    @JsonIgnore
    public List getSubscriptionPlans() {
        return OptionalNullable.getFrom(subscriptionPlans);
    }

    @Override
    public int hashCode() {
        return Objects.hash(orders, subscriptionPlans);
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == this) {
            return true;
        }
        if (!(obj instanceof PaymentLinkRelatedResources)) {
            return false;
        }
        PaymentLinkRelatedResources other = (PaymentLinkRelatedResources) obj;
        return Objects.equals(orders, other.orders) && Objects.equals(subscriptionPlans, other.subscriptionPlans);
    }

    /**
     * Converts this PaymentLinkRelatedResources into string format.
     * @return String representation of this class
     */
    @Override
    public String toString() {
        return "PaymentLinkRelatedResources [" + "orders=" + orders + ", subscriptionPlans=" + subscriptionPlans + "]";
    }

    /**
     * Builds a new {@link PaymentLinkRelatedResources.Builder} object.
     * Creates the instance with the state of the current model.
     * @return a new {@link PaymentLinkRelatedResources.Builder} object
     */
    public Builder toBuilder() {
        Builder builder = new Builder();
        builder.orders = internalGetOrders();
        builder.subscriptionPlans = internalGetSubscriptionPlans();
        return builder;
    }

    /**
     * Class to build instances of {@link PaymentLinkRelatedResources}.
     */
    public static class Builder {
        private OptionalNullable> orders;
        private OptionalNullable> subscriptionPlans;

        /**
         * Setter for orders.
         * @param  orders  List of Order value for orders.
         * @return Builder
         */
        public Builder orders(List orders) {
            this.orders = OptionalNullable.of(orders);
            return this;
        }

        /**
         * UnSetter for orders.
         * @return Builder
         */
        public Builder unsetOrders() {
            orders = null;
            return this;
        }

        /**
         * Setter for subscriptionPlans.
         * @param  subscriptionPlans  List of CatalogObject value for subscriptionPlans.
         * @return Builder
         */
        public Builder subscriptionPlans(List subscriptionPlans) {
            this.subscriptionPlans = OptionalNullable.of(subscriptionPlans);
            return this;
        }

        /**
         * UnSetter for subscriptionPlans.
         * @return Builder
         */
        public Builder unsetSubscriptionPlans() {
            subscriptionPlans = null;
            return this;
        }

        /**
         * Builds a new {@link PaymentLinkRelatedResources} object using the set fields.
         * @return {@link PaymentLinkRelatedResources}
         */
        public PaymentLinkRelatedResources build() {
            return new PaymentLinkRelatedResources(orders, subscriptionPlans);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy