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

package com.azure.resourcemanager.machinelearningservices.models;

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

/** The RSection model. */
@Fluent
public class RSection {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(RSection.class);

    /*
     * The version of R to be installed
     */
    @JsonProperty(value = "rVersion")
    private String rVersion;

    /*
     * Indicates whether the environment is managed by user or by AzureML.
     */
    @JsonProperty(value = "userManaged")
    private Boolean userManaged;

    /*
     * The Rscript path to use if an environment build is not required.
     * The path specified gets used to call the user script.
     */
    @JsonProperty(value = "rscriptPath")
    private String rscriptPath;

    /*
     * Date of MRAN snapshot to use in YYYY-MM-DD format, e.g. "2019-04-17"
     */
    @JsonProperty(value = "snapshotDate")
    private String snapshotDate;

    /*
     * The CRAN packages to use.
     */
    @JsonProperty(value = "cranPackages")
    private List<RCranPackage> cranPackages;

    /*
     * The packages directly from GitHub.
     */
    @JsonProperty(value = "gitHubPackages")
    private List<RGitHubPackage> gitHubPackages;

    /*
     * The packages from custom urls.
     */
    @JsonProperty(value = "customUrlPackages")
    private List<String> customUrlPackages;

    /*
     * The packages from Bioconductor.
     */
    @JsonProperty(value = "bioConductorPackages")
    private List<String> bioConductorPackages;

    /**
     * Get the rVersion property: The version of R to be installed.
     *
     * @return the rVersion value.
     */
    public String rVersion() {
        return this.rVersion;
    }

    /**
     * Set the rVersion property: The version of R to be installed.
     *
     * @param rVersion the rVersion value to set.
     * @return the RSection object itself.
     */
    public RSection withRVersion(String rVersion) {
        this.rVersion = rVersion;
        return this;
    }

    /**
     * Get the userManaged property: Indicates whether the environment is managed by user or by AzureML.
     *
     * @return the userManaged value.
     */
    public Boolean userManaged() {
        return this.userManaged;
    }

    /**
     * Set the userManaged property: Indicates whether the environment is managed by user or by AzureML.
     *
     * @param userManaged the userManaged value to set.
     * @return the RSection object itself.
     */
    public RSection withUserManaged(Boolean userManaged) {
        this.userManaged = userManaged;
        return this;
    }

    /**
     * Get the rscriptPath property: The Rscript path to use if an environment build is not required. The path specified
     * gets used to call the user script.
     *
     * @return the rscriptPath value.
     */
    public String rscriptPath() {
        return this.rscriptPath;
    }

    /**
     * Set the rscriptPath property: The Rscript path to use if an environment build is not required. The path specified
     * gets used to call the user script.
     *
     * @param rscriptPath the rscriptPath value to set.
     * @return the RSection object itself.
     */
    public RSection withRscriptPath(String rscriptPath) {
        this.rscriptPath = rscriptPath;
        return this;
    }

    /**
     * Get the snapshotDate property: Date of MRAN snapshot to use in YYYY-MM-DD format, e.g. "2019-04-17".
     *
     * @return the snapshotDate value.
     */
    public String snapshotDate() {
        return this.snapshotDate;
    }

    /**
     * Set the snapshotDate property: Date of MRAN snapshot to use in YYYY-MM-DD format, e.g. "2019-04-17".
     *
     * @param snapshotDate the snapshotDate value to set.
     * @return the RSection object itself.
     */
    public RSection withSnapshotDate(String snapshotDate) {
        this.snapshotDate = snapshotDate;
        return this;
    }

    /**
     * Get the cranPackages property: The CRAN packages to use.
     *
     * @return the cranPackages value.
     */
    public List<RCranPackage> cranPackages() {
        return this.cranPackages;
    }

    /**
     * Set the cranPackages property: The CRAN packages to use.
     *
     * @param cranPackages the cranPackages value to set.
     * @return the RSection object itself.
     */
    public RSection withCranPackages(List<RCranPackage> cranPackages) {
        this.cranPackages = cranPackages;
        return this;
    }

    /**
     * Get the gitHubPackages property: The packages directly from GitHub.
     *
     * @return the gitHubPackages value.
     */
    public List<RGitHubPackage> gitHubPackages() {
        return this.gitHubPackages;
    }

    /**
     * Set the gitHubPackages property: The packages directly from GitHub.
     *
     * @param gitHubPackages the gitHubPackages value to set.
     * @return the RSection object itself.
     */
    public RSection withGitHubPackages(List<RGitHubPackage> gitHubPackages) {
        this.gitHubPackages = gitHubPackages;
        return this;
    }

    /**
     * Get the customUrlPackages property: The packages from custom urls.
     *
     * @return the customUrlPackages value.
     */
    public List<String> customUrlPackages() {
        return this.customUrlPackages;
    }

    /**
     * Set the customUrlPackages property: The packages from custom urls.
     *
     * @param customUrlPackages the customUrlPackages value to set.
     * @return the RSection object itself.
     */
    public RSection withCustomUrlPackages(List<String> customUrlPackages) {
        this.customUrlPackages = customUrlPackages;
        return this;
    }

    /**
     * Get the bioConductorPackages property: The packages from Bioconductor.
     *
     * @return the bioConductorPackages value.
     */
    public List<String> bioConductorPackages() {
        return this.bioConductorPackages;
    }

    /**
     * Set the bioConductorPackages property: The packages from Bioconductor.
     *
     * @param bioConductorPackages the bioConductorPackages value to set.
     * @return the RSection object itself.
     */
    public RSection withBioConductorPackages(List<String> bioConductorPackages) {
        this.bioConductorPackages = bioConductorPackages;
        return this;
    }

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