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

package com.azure.resourcemanager.machinelearning.models;

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

/** Environment version details. */
@Fluent
public final class EnvironmentVersionProperties extends AssetBase {
    /*
     * Defines if image needs to be rebuilt based on base image changes.
     */
    @JsonProperty(value = "autoRebuild")
    private AutoRebuildSetting autoRebuild;

    /*
     * Configuration settings for Docker build context.
     */
    @JsonProperty(value = "build")
    private BuildContext build;

    /*
     * Standard configuration file used by Conda that lets you install any kind of package, including Python, R, and
     * C/C++ packages.
     * <see
     * href="https://repo2docker.readthedocs.io/en/latest/config_files.html#environment-yml-install-a-conda-environment"
     * />
     */
    @JsonProperty(value = "condaFile")
    private String condaFile;

    /*
     * Environment type is either user managed or curated by the Azure ML service
     * <see href="https://docs.microsoft.com/en-us/azure/machine-learning/resource-curated-environments" />
     */
    @JsonProperty(value = "environmentType", access = JsonProperty.Access.WRITE_ONLY)
    private EnvironmentType environmentType;

    /*
     * Name of the image that will be used for the environment.
     * <seealso
     * href="https://docs.microsoft.com/en-us/azure/machine-learning"
         + "/how-to-deploy-custom-docker-image#use-a-custom-base-image"
     * />
     */
    @JsonProperty(value = "image")
    private String image;

    /*
     * Defines configuration specific to inference.
     */
    @JsonProperty(value = "inferenceConfig")
    private InferenceContainerProperties inferenceConfig;

    /*
     * The OS type of the environment.
     */
    @JsonProperty(value = "osType")
    private OperatingSystemType osType;

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

    /**
     * Get the autoRebuild property: Defines if image needs to be rebuilt based on base image changes.
     *
     * @return the autoRebuild value.
     */
    public AutoRebuildSetting autoRebuild() {
        return this.autoRebuild;
    }

    /**
     * Set the autoRebuild property: Defines if image needs to be rebuilt based on base image changes.
     *
     * @param autoRebuild the autoRebuild value to set.
     * @return the EnvironmentVersionProperties object itself.
     */
    public EnvironmentVersionProperties withAutoRebuild(AutoRebuildSetting autoRebuild) {
        this.autoRebuild = autoRebuild;
        return this;
    }

    /**
     * Get the build property: Configuration settings for Docker build context.
     *
     * @return the build value.
     */
    public BuildContext build() {
        return this.build;
    }

    /**
     * Set the build property: Configuration settings for Docker build context.
     *
     * @param build the build value to set.
     * @return the EnvironmentVersionProperties object itself.
     */
    public EnvironmentVersionProperties withBuild(BuildContext build) {
        this.build = build;
        return this;
    }

    /**
     * Get the condaFile property: Standard configuration file used by Conda that lets you install any kind of package,
     * including Python, R, and C/C++ packages. &lt;see
     * href="https://repo2docker.readthedocs.io/en/latest/config_files.html#environment-yml-install-a-conda-environment"
     * /&gt;.
     *
     * @return the condaFile value.
     */
    public String condaFile() {
        return this.condaFile;
    }

    /**
     * Set the condaFile property: Standard configuration file used by Conda that lets you install any kind of package,
     * including Python, R, and C/C++ packages. &lt;see
     * href="https://repo2docker.readthedocs.io/en/latest/config_files.html#environment-yml-install-a-conda-environment"
     * /&gt;.
     *
     * @param condaFile the condaFile value to set.
     * @return the EnvironmentVersionProperties object itself.
     */
    public EnvironmentVersionProperties withCondaFile(String condaFile) {
        this.condaFile = condaFile;
        return this;
    }

    /**
     * Get the environmentType property: Environment type is either user managed or curated by the Azure ML service
     * &lt;see href="https://docs.microsoft.com/en-us/azure/machine-learning/resource-curated-environments" /&gt;.
     *
     * @return the environmentType value.
     */
    public EnvironmentType environmentType() {
        return this.environmentType;
    }

    /**
     * Get the image property: Name of the image that will be used for the environment. &lt;seealso
     * href="https://docs.microsoft.com/en-us/azure/machine-learning"
         + "/how-to-deploy-custom-docker-image#use-a-custom-base-image"
     * /&gt;.
     *
     * @return the image value.
     */
    public String image() {
        return this.image;
    }

    /**
     * Set the image property: Name of the image that will be used for the environment. &lt;seealso
     * href="https://docs.microsoft.com/en-us/azure/machine-learning"
         + "/how-to-deploy-custom-docker-image#use-a-custom-base-image"
     * /&gt;.
     *
     * @param image the image value to set.
     * @return the EnvironmentVersionProperties object itself.
     */
    public EnvironmentVersionProperties withImage(String image) {
        this.image = image;
        return this;
    }

    /**
     * Get the inferenceConfig property: Defines configuration specific to inference.
     *
     * @return the inferenceConfig value.
     */
    public InferenceContainerProperties inferenceConfig() {
        return this.inferenceConfig;
    }

    /**
     * Set the inferenceConfig property: Defines configuration specific to inference.
     *
     * @param inferenceConfig the inferenceConfig value to set.
     * @return the EnvironmentVersionProperties object itself.
     */
    public EnvironmentVersionProperties withInferenceConfig(InferenceContainerProperties inferenceConfig) {
        this.inferenceConfig = inferenceConfig;
        return this;
    }

    /**
     * Get the osType property: The OS type of the environment.
     *
     * @return the osType value.
     */
    public OperatingSystemType osType() {
        return this.osType;
    }

    /**
     * Set the osType property: The OS type of the environment.
     *
     * @param osType the osType value to set.
     * @return the EnvironmentVersionProperties object itself.
     */
    public EnvironmentVersionProperties withOsType(OperatingSystemType osType) {
        this.osType = osType;
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public EnvironmentVersionProperties withIsAnonymous(Boolean isAnonymous) {
        super.withIsAnonymous(isAnonymous);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public EnvironmentVersionProperties withIsArchived(Boolean isArchived) {
        super.withIsArchived(isArchived);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public EnvironmentVersionProperties withDescription(String description) {
        super.withDescription(description);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public EnvironmentVersionProperties withProperties(Map<String, String> properties) {
        super.withProperties(properties);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public EnvironmentVersionProperties withTags(Map<String, String> tags) {
        super.withTags(tags);
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
        super.validate();
        if (build() != null) {
            build().validate();
        }
        if (inferenceConfig() != null) {
            inferenceConfig().validate();
        }
    }
}
