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

package com.azure.resourcemanager.securitydevops.models;

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

/** Org onboarding info. */
@Fluent
public final class AzureDevOpsOrgMetadata {
    /*
     * Gets or sets name of the AzureDevOps Org.
     */
    @JsonProperty(value = "name")
    private String name;

    /*
     * The autoDiscovery property.
     */
    @JsonProperty(value = "autoDiscovery")
    private AutoDiscovery autoDiscovery;

    /*
     * The projects property.
     */
    @JsonProperty(value = "projects")
    private List<AzureDevOpsProjectMetadata> projects;

    /** Creates an instance of AzureDevOpsOrgMetadata class. */
    public AzureDevOpsOrgMetadata() {
    }

    /**
     * Get the name property: Gets or sets name of the AzureDevOps Org.
     *
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Set the name property: Gets or sets name of the AzureDevOps Org.
     *
     * @param name the name value to set.
     * @return the AzureDevOpsOrgMetadata object itself.
     */
    public AzureDevOpsOrgMetadata withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * Get the autoDiscovery property: The autoDiscovery property.
     *
     * @return the autoDiscovery value.
     */
    public AutoDiscovery autoDiscovery() {
        return this.autoDiscovery;
    }

    /**
     * Set the autoDiscovery property: The autoDiscovery property.
     *
     * @param autoDiscovery the autoDiscovery value to set.
     * @return the AzureDevOpsOrgMetadata object itself.
     */
    public AzureDevOpsOrgMetadata withAutoDiscovery(AutoDiscovery autoDiscovery) {
        this.autoDiscovery = autoDiscovery;
        return this;
    }

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

    /**
     * Set the projects property: The projects property.
     *
     * @param projects the projects value to set.
     * @return the AzureDevOpsOrgMetadata object itself.
     */
    public AzureDevOpsOrgMetadata withProjects(List<AzureDevOpsProjectMetadata> projects) {
        this.projects = projects;
        return this;
    }

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