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

package com.azure.resourcemanager.securityinsights.models;

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

/** Get Insights result metadata. */
@Fluent
public final class GetInsightsResultsMetadata {
    /*
     * the total items found for the insights request
     */
    @JsonProperty(value = "totalCount", required = true)
    private int totalCount;

    /*
     * information about the failed queries
     */
    @JsonProperty(value = "errors")
    private List<GetInsightsErrorKind> errors;

    /**
     * Get the totalCount property: the total items found for the insights request.
     *
     * @return the totalCount value.
     */
    public int totalCount() {
        return this.totalCount;
    }

    /**
     * Set the totalCount property: the total items found for the insights request.
     *
     * @param totalCount the totalCount value to set.
     * @return the GetInsightsResultsMetadata object itself.
     */
    public GetInsightsResultsMetadata withTotalCount(int totalCount) {
        this.totalCount = totalCount;
        return this;
    }

    /**
     * Get the errors property: information about the failed queries.
     *
     * @return the errors value.
     */
    public List<GetInsightsErrorKind> errors() {
        return this.errors;
    }

    /**
     * Set the errors property: information about the failed queries.
     *
     * @param errors the errors value to set.
     * @return the GetInsightsResultsMetadata object itself.
     */
    public GetInsightsResultsMetadata withErrors(List<GetInsightsErrorKind> errors) {
        this.errors = errors;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (errors() != null) {
            errors().forEach(e -> e.validate());
        }
    }
}
