// 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.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.Map;

/**
 * Information about a SparkConfiguration created at the workspace level.
 *
 * <p>SparkConfiguration Artifact information.
 */
@Fluent
public final class SparkConfigurationInfo {
    /*
     * Description about the SparkConfiguration.
     */
    @JsonProperty(value = "description")
    private String description;

    /*
     * SparkConfiguration configs.
     */
    @JsonProperty(value = "configs", required = true)
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, String> configs;

    /*
     * Annotations for SparkConfiguration.
     */
    @JsonProperty(value = "annotations")
    private List<String> annotations;

    /*
     * additional Notes.
     */
    @JsonProperty(value = "notes")
    private String notes;

    /*
     * The identity that created the resource.
     */
    @JsonProperty(value = "createdBy")
    private String createdBy;

    /*
     * The timestamp of resource creation.
     */
    @JsonProperty(value = "created")
    private OffsetDateTime created;

    /*
     * SparkConfiguration merge configs.
     */
    @JsonProperty(value = "configMergeRule")
    @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
    private Map<String, String> configMergeRule;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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