// 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;

/** The results of a query operation and an optional continuation token. */
@Fluent
public final class QueryResult {
    /*
     * The query results.
     */
    @JsonProperty(value = "value", required = true)
    private List<Object> value;

    /*
     * A token which can be used to construct a new QuerySpecification to
     * retrieve the next set of results.
     */
    @JsonProperty(value = "continuationToken")
    private String continuationToken;

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

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

    /**
     * Get the continuationToken property: A token which can be used to construct a new QuerySpecification to retrieve
     * the next set of results.
     *
     * @return the continuationToken value.
     */
    public String getContinuationToken() {
        return this.continuationToken;
    }

    /**
     * Set the continuationToken property: A token which can be used to construct a new QuerySpecification to retrieve
     * the next set of results.
     *
     * @param continuationToken the continuationToken value to set.
     * @return the QueryResult object itself.
     */
    public QueryResult setContinuationToken(String continuationToken) {
        this.continuationToken = continuationToken;
        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 QueryResult");
        }
    }
}
