// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.digitaltwins.core.implementation.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** A collection of incoming relationships which relate digital twins together. */
@Fluent
public final class IncomingRelationshipCollection {
    /*
     * The value property.
     */
    @JsonProperty(value = "value", required = true)
    private List<IncomingRelationship> value;

    /*
     * A URI to retrieve the next page of objects.
     */
    @JsonProperty(value = "nextLink")
    private String nextLink;

    /**
     * Creates an instance of IncomingRelationshipCollection class.
     *
     * @param value the value value to set.
     */
    @JsonCreator
    public IncomingRelationshipCollection(
            @JsonProperty(value = "value", required = true) List<IncomingRelationship> value) {
        this.value = value;
    }

    /**
     * Get the value property: The value property.
     *
     * @return the value value.
     */
    public List<IncomingRelationship> getValue() {
        return this.value;
    }

    /**
     * Get the nextLink property: A URI to retrieve the next page of objects.
     *
     * @return the nextLink value.
     */
    public String getNextLink() {
        return this.nextLink;
    }

    /**
     * Set the nextLink property: A URI to retrieve the next page of objects.
     *
     * @param nextLink the nextLink value to set.
     * @return the IncomingRelationshipCollection object itself.
     */
    public IncomingRelationshipCollection setNextLink(String nextLink) {
        this.nextLink = nextLink;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (getValue() == null) {
            throw new IllegalArgumentException(
                    "Missing required property value in model IncomingRelationshipCollection");
        } else {
            getValue().forEach(e -> e.validate());
        }
    }
}
