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

package com.azure.resourcemanager.datafactory.models;

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.datafactory.fluent.models.XmlDatasetTypeProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import java.util.List;
import java.util.Map;

/** Xml dataset. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
@JsonTypeName("Xml")
@Fluent
public final class XmlDataset extends Dataset {
    /*
     * Xml dataset properties.
     */
    @JsonProperty(value = "typeProperties")
    private XmlDatasetTypeProperties innerTypeProperties;

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

    /**
     * Get the innerTypeProperties property: Xml dataset properties.
     *
     * @return the innerTypeProperties value.
     */
    private XmlDatasetTypeProperties innerTypeProperties() {
        return this.innerTypeProperties;
    }

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

    /** {@inheritDoc} */
    @Override
    public XmlDataset withStructure(Object structure) {
        super.withStructure(structure);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public XmlDataset withSchema(Object schema) {
        super.withSchema(schema);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public XmlDataset withLinkedServiceName(LinkedServiceReference linkedServiceName) {
        super.withLinkedServiceName(linkedServiceName);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public XmlDataset withParameters(Map<String, ParameterSpecification> parameters) {
        super.withParameters(parameters);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public XmlDataset withAnnotations(List<Object> annotations) {
        super.withAnnotations(annotations);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public XmlDataset withFolder(DatasetFolder folder) {
        super.withFolder(folder);
        return this;
    }

    /**
     * Get the location property: The location of the json data storage.
     *
     * @return the location value.
     */
    public DatasetLocation location() {
        return this.innerTypeProperties() == null ? null : this.innerTypeProperties().location();
    }

    /**
     * Set the location property: The location of the json data storage.
     *
     * @param location the location value to set.
     * @return the XmlDataset object itself.
     */
    public XmlDataset withLocation(DatasetLocation location) {
        if (this.innerTypeProperties() == null) {
            this.innerTypeProperties = new XmlDatasetTypeProperties();
        }
        this.innerTypeProperties().withLocation(location);
        return this;
    }

    /**
     * Get the encodingName property: The code page name of the preferred encoding. If not specified, the default value
     * is UTF-8, unless BOM denotes another Unicode encoding. Refer to the name column of the table in the following
     * link to set supported values: https://msdn.microsoft.com/library/system.text.encoding.aspx. Type: string (or
     * Expression with resultType string).
     *
     * @return the encodingName value.
     */
    public Object encodingName() {
        return this.innerTypeProperties() == null ? null : this.innerTypeProperties().encodingName();
    }

    /**
     * Set the encodingName property: The code page name of the preferred encoding. If not specified, the default value
     * is UTF-8, unless BOM denotes another Unicode encoding. Refer to the name column of the table in the following
     * link to set supported values: https://msdn.microsoft.com/library/system.text.encoding.aspx. Type: string (or
     * Expression with resultType string).
     *
     * @param encodingName the encodingName value to set.
     * @return the XmlDataset object itself.
     */
    public XmlDataset withEncodingName(Object encodingName) {
        if (this.innerTypeProperties() == null) {
            this.innerTypeProperties = new XmlDatasetTypeProperties();
        }
        this.innerTypeProperties().withEncodingName(encodingName);
        return this;
    }

    /**
     * Get the nullValue property: The null value string. Type: string (or Expression with resultType string).
     *
     * @return the nullValue value.
     */
    public Object nullValue() {
        return this.innerTypeProperties() == null ? null : this.innerTypeProperties().nullValue();
    }

    /**
     * Set the nullValue property: The null value string. Type: string (or Expression with resultType string).
     *
     * @param nullValue the nullValue value to set.
     * @return the XmlDataset object itself.
     */
    public XmlDataset withNullValue(Object nullValue) {
        if (this.innerTypeProperties() == null) {
            this.innerTypeProperties = new XmlDatasetTypeProperties();
        }
        this.innerTypeProperties().withNullValue(nullValue);
        return this;
    }

    /**
     * Get the compression property: The data compression method used for the json dataset.
     *
     * @return the compression value.
     */
    public DatasetCompression compression() {
        return this.innerTypeProperties() == null ? null : this.innerTypeProperties().compression();
    }

    /**
     * Set the compression property: The data compression method used for the json dataset.
     *
     * @param compression the compression value to set.
     * @return the XmlDataset object itself.
     */
    public XmlDataset withCompression(DatasetCompression compression) {
        if (this.innerTypeProperties() == null) {
            this.innerTypeProperties = new XmlDatasetTypeProperties();
        }
        this.innerTypeProperties().withCompression(compression);
        return this;
    }

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