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

/** Permissions required for the connector. */
@Fluent
public final class Permissions {
    /*
     * Resource provider permissions required for the connector
     */
    @JsonProperty(value = "resourceProvider")
    private List<PermissionsResourceProviderItem> resourceProvider;

    /*
     * Customs permissions required for the connector
     */
    @JsonProperty(value = "customs")
    private List<PermissionsCustomsItem> customs;

    /**
     * Get the resourceProvider property: Resource provider permissions required for the connector.
     *
     * @return the resourceProvider value.
     */
    public List<PermissionsResourceProviderItem> resourceProvider() {
        return this.resourceProvider;
    }

    /**
     * Set the resourceProvider property: Resource provider permissions required for the connector.
     *
     * @param resourceProvider the resourceProvider value to set.
     * @return the Permissions object itself.
     */
    public Permissions withResourceProvider(List<PermissionsResourceProviderItem> resourceProvider) {
        this.resourceProvider = resourceProvider;
        return this;
    }

    /**
     * Get the customs property: Customs permissions required for the connector.
     *
     * @return the customs value.
     */
    public List<PermissionsCustomsItem> customs() {
        return this.customs;
    }

    /**
     * Set the customs property: Customs permissions required for the connector.
     *
     * @param customs the customs value to set.
     * @return the Permissions object itself.
     */
    public Permissions withCustoms(List<PermissionsCustomsItem> customs) {
        this.customs = customs;
        return this;
    }

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