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

package com.azure.resourcemanager.azurearcdata.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.core.management.SystemData;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.azurearcdata.models.DataControllerProperties;
import com.azure.resourcemanager.azurearcdata.models.ExtendedLocation;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;

/** Data controller resource. */
@Fluent
public final class DataControllerResourceInner extends Resource {
    /*
     * The extendedLocation of the resource.
     */
    @JsonProperty(value = "extendedLocation")
    private ExtendedLocation extendedLocation;

    /*
     * The data controller's properties
     */
    @JsonProperty(value = "properties", required = true)
    private DataControllerProperties properties;

    /*
     * Read only system data
     */
    @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY)
    private SystemData systemData;

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

    /**
     * Get the extendedLocation property: The extendedLocation of the resource.
     *
     * @return the extendedLocation value.
     */
    public ExtendedLocation extendedLocation() {
        return this.extendedLocation;
    }

    /**
     * Set the extendedLocation property: The extendedLocation of the resource.
     *
     * @param extendedLocation the extendedLocation value to set.
     * @return the DataControllerResourceInner object itself.
     */
    public DataControllerResourceInner withExtendedLocation(ExtendedLocation extendedLocation) {
        this.extendedLocation = extendedLocation;
        return this;
    }

    /**
     * Get the properties property: The data controller's properties.
     *
     * @return the properties value.
     */
    public DataControllerProperties properties() {
        return this.properties;
    }

    /**
     * Set the properties property: The data controller's properties.
     *
     * @param properties the properties value to set.
     * @return the DataControllerResourceInner object itself.
     */
    public DataControllerResourceInner withProperties(DataControllerProperties properties) {
        this.properties = properties;
        return this;
    }

    /**
     * Get the systemData property: Read only system data.
     *
     * @return the systemData value.
     */
    public SystemData systemData() {
        return this.systemData;
    }

    /** {@inheritDoc} */
    @Override
    public DataControllerResourceInner withLocation(String location) {
        super.withLocation(location);
        return this;
    }

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

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (extendedLocation() != null) {
            extendedLocation().validate();
        }
        if (properties() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property properties in model DataControllerResourceInner"));
        } else {
            properties().validate();
        }
    }

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