// 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.JsonProperty;

/** A class representing follower database request. */
@Fluent
public final class FollowerDatabaseDefinitionInner {
    /*
     * Resource id of the cluster that follows a database owned by this cluster.
     */
    @JsonProperty(value = "clusterResourceId", required = true)
    private String kustoPoolResourceId;

    /*
     * Resource name of the attached database configuration in the follower cluster.
     */
    @JsonProperty(value = "attachedDatabaseConfigurationName", required = true)
    private String attachedDatabaseConfigurationName;

    /*
     * The database name owned by this cluster that was followed. * in case following all databases.
     */
    @JsonProperty(value = "databaseName", access = JsonProperty.Access.WRITE_ONLY)
    private String databaseName;

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

    /**
     * Get the kustoPoolResourceId property: Resource id of the cluster that follows a database owned by this cluster.
     *
     * @return the kustoPoolResourceId value.
     */
    public String kustoPoolResourceId() {
        return this.kustoPoolResourceId;
    }

    /**
     * Set the kustoPoolResourceId property: Resource id of the cluster that follows a database owned by this cluster.
     *
     * @param kustoPoolResourceId the kustoPoolResourceId value to set.
     * @return the FollowerDatabaseDefinitionInner object itself.
     */
    public FollowerDatabaseDefinitionInner withKustoPoolResourceId(String kustoPoolResourceId) {
        this.kustoPoolResourceId = kustoPoolResourceId;
        return this;
    }

    /**
     * Get the attachedDatabaseConfigurationName property: Resource name of the attached database configuration in the
     * follower cluster.
     *
     * @return the attachedDatabaseConfigurationName value.
     */
    public String attachedDatabaseConfigurationName() {
        return this.attachedDatabaseConfigurationName;
    }

    /**
     * Set the attachedDatabaseConfigurationName property: Resource name of the attached database configuration in the
     * follower cluster.
     *
     * @param attachedDatabaseConfigurationName the attachedDatabaseConfigurationName value to set.
     * @return the FollowerDatabaseDefinitionInner object itself.
     */
    public FollowerDatabaseDefinitionInner withAttachedDatabaseConfigurationName(
        String attachedDatabaseConfigurationName) {
        this.attachedDatabaseConfigurationName = attachedDatabaseConfigurationName;
        return this;
    }

    /**
     * Get the databaseName property: The database name owned by this cluster that was followed. * in case following all
     * databases.
     *
     * @return the databaseName value.
     */
    public String databaseName() {
        return this.databaseName;
    }

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

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