// 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.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import java.util.Map;

/** Data version base definition. */
@JsonTypeInfo(
    use = JsonTypeInfo.Id.NAME,
    include = JsonTypeInfo.As.PROPERTY,
    property = "dataType",
    defaultImpl = DataVersionBaseProperties.class)
@JsonTypeName("DataVersionBaseProperties")
@JsonSubTypes({
    @JsonSubTypes.Type(name = "mltable", value = MLTableData.class),
    @JsonSubTypes.Type(name = "uri_file", value = UriFileDataVersion.class),
    @JsonSubTypes.Type(name = "uri_folder", value = UriFolderDataVersion.class)
})
@Fluent
public class DataVersionBaseProperties extends AssetBase {
    /*
     * [Required] Uri of the data. Usage/meaning depends on
     * Microsoft.MachineLearning.ManagementFrontEnd.Contracts.V20221001.Assets.DataVersionBase.DataType
     */
    @JsonProperty(value = "dataUri", required = true)
    private String dataUri;

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

    /**
     * Get the dataUri property: [Required] Uri of the data. Usage/meaning depends on
     * Microsoft.MachineLearning.ManagementFrontEnd.Contracts.V20221001.Assets.DataVersionBase.DataType.
     *
     * @return the dataUri value.
     */
    public String dataUri() {
        return this.dataUri;
    }

    /**
     * Set the dataUri property: [Required] Uri of the data. Usage/meaning depends on
     * Microsoft.MachineLearning.ManagementFrontEnd.Contracts.V20221001.Assets.DataVersionBase.DataType.
     *
     * @param dataUri the dataUri value to set.
     * @return the DataVersionBaseProperties object itself.
     */
    public DataVersionBaseProperties withDataUri(String dataUri) {
        this.dataUri = dataUri;
        return this;
    }

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

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

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

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

    /** {@inheritDoc} */
    @Override
    public DataVersionBaseProperties 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 (dataUri() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property dataUri in model DataVersionBaseProperties"));
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(DataVersionBaseProperties.class);
}
