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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.synapse.models.EntityResource;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.Map;

/** SparkConfiguration response details. */
@Fluent
public final class SparkConfigurationResourceInner extends EntityResource {
    /*
     * Information about a SparkConfiguration created at the workspace level.
     *
     * SparkConfiguration properties.
     */
    @JsonProperty(value = "properties", required = true)
    private SparkConfigurationInfo innerProperties = new SparkConfigurationInfo();

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

    /**
     * Get the innerProperties property: Information about a SparkConfiguration created at the workspace level.
     *
     * <p>SparkConfiguration properties.
     *
     * @return the innerProperties value.
     */
    private SparkConfigurationInfo innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the description property: Description about the SparkConfiguration.
     *
     * @return the description value.
     */
    public String description() {
        return this.innerProperties() == null ? null : this.innerProperties().description();
    }

    /**
     * Set the description property: Description about the SparkConfiguration.
     *
     * @param description the description value to set.
     * @return the SparkConfigurationResourceInner object itself.
     */
    public SparkConfigurationResourceInner withDescription(String description) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SparkConfigurationInfo();
        }
        this.innerProperties().withDescription(description);
        return this;
    }

    /**
     * Get the configs property: SparkConfiguration configs.
     *
     * @return the configs value.
     */
    public Map<String, String> configs() {
        return this.innerProperties() == null ? null : this.innerProperties().configs();
    }

    /**
     * Set the configs property: SparkConfiguration configs.
     *
     * @param configs the configs value to set.
     * @return the SparkConfigurationResourceInner object itself.
     */
    public SparkConfigurationResourceInner withConfigs(Map<String, String> configs) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SparkConfigurationInfo();
        }
        this.innerProperties().withConfigs(configs);
        return this;
    }

    /**
     * Get the annotations property: Annotations for SparkConfiguration.
     *
     * @return the annotations value.
     */
    public List<String> annotations() {
        return this.innerProperties() == null ? null : this.innerProperties().annotations();
    }

    /**
     * Set the annotations property: Annotations for SparkConfiguration.
     *
     * @param annotations the annotations value to set.
     * @return the SparkConfigurationResourceInner object itself.
     */
    public SparkConfigurationResourceInner withAnnotations(List<String> annotations) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SparkConfigurationInfo();
        }
        this.innerProperties().withAnnotations(annotations);
        return this;
    }

    /**
     * Get the notes property: additional Notes.
     *
     * @return the notes value.
     */
    public String notes() {
        return this.innerProperties() == null ? null : this.innerProperties().notes();
    }

    /**
     * Set the notes property: additional Notes.
     *
     * @param notes the notes value to set.
     * @return the SparkConfigurationResourceInner object itself.
     */
    public SparkConfigurationResourceInner withNotes(String notes) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SparkConfigurationInfo();
        }
        this.innerProperties().withNotes(notes);
        return this;
    }

    /**
     * Get the createdBy property: The identity that created the resource.
     *
     * @return the createdBy value.
     */
    public String createdBy() {
        return this.innerProperties() == null ? null : this.innerProperties().createdBy();
    }

    /**
     * Set the createdBy property: The identity that created the resource.
     *
     * @param createdBy the createdBy value to set.
     * @return the SparkConfigurationResourceInner object itself.
     */
    public SparkConfigurationResourceInner withCreatedBy(String createdBy) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SparkConfigurationInfo();
        }
        this.innerProperties().withCreatedBy(createdBy);
        return this;
    }

    /**
     * Get the created property: The timestamp of resource creation.
     *
     * @return the created value.
     */
    public OffsetDateTime created() {
        return this.innerProperties() == null ? null : this.innerProperties().created();
    }

    /**
     * Set the created property: The timestamp of resource creation.
     *
     * @param created the created value to set.
     * @return the SparkConfigurationResourceInner object itself.
     */
    public SparkConfigurationResourceInner withCreated(OffsetDateTime created) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SparkConfigurationInfo();
        }
        this.innerProperties().withCreated(created);
        return this;
    }

    /**
     * Get the configMergeRule property: SparkConfiguration merge configs.
     *
     * @return the configMergeRule value.
     */
    public Map<String, String> configMergeRule() {
        return this.innerProperties() == null ? null : this.innerProperties().configMergeRule();
    }

    /**
     * Set the configMergeRule property: SparkConfiguration merge configs.
     *
     * @param configMergeRule the configMergeRule value to set.
     * @return the SparkConfigurationResourceInner object itself.
     */
    public SparkConfigurationResourceInner withConfigMergeRule(Map<String, String> configMergeRule) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SparkConfigurationInfo();
        }
        this.innerProperties().withConfigMergeRule(configMergeRule);
        return this;
    }

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

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