// 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 ModelSparkSection model. */
@Fluent
public class ModelSparkSection {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(ModelSparkSection.class);

    /*
     * The list of spark repositories.
     */
    @JsonProperty(value = "repositories")
    private List<String> repositories;

    /*
     * The Spark packages to use.
     */
    @JsonProperty(value = "packages")
    private List<SparkMavenPackage> packages;

    /*
     * Whether to precache the packages.
     */
    @JsonProperty(value = "precachePackages")
    private Boolean precachePackages;

    /**
     * Get the repositories property: The list of spark repositories.
     *
     * @return the repositories value.
     */
    public List<String> repositories() {
        return this.repositories;
    }

    /**
     * Set the repositories property: The list of spark repositories.
     *
     * @param repositories the repositories value to set.
     * @return the ModelSparkSection object itself.
     */
    public ModelSparkSection withRepositories(List<String> repositories) {
        this.repositories = repositories;
        return this;
    }

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

    /**
     * Set the packages property: The Spark packages to use.
     *
     * @param packages the packages value to set.
     * @return the ModelSparkSection object itself.
     */
    public ModelSparkSection withPackages(List<SparkMavenPackage> packages) {
        this.packages = packages;
        return this;
    }

    /**
     * Get the precachePackages property: Whether to precache the packages.
     *
     * @return the precachePackages value.
     */
    public Boolean precachePackages() {
        return this.precachePackages;
    }

    /**
     * Set the precachePackages property: Whether to precache the packages.
     *
     * @param precachePackages the precachePackages value to set.
     * @return the ModelSparkSection object itself.
     */
    public ModelSparkSection withPrecachePackages(Boolean precachePackages) {
        this.precachePackages = precachePackages;
        return this;
    }

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