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

package com.azure.resourcemanager.postgresqlflexibleserver.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Server admin credentials. */
@Fluent
public final class AdminCredentials {
    /*
     * Password for source server.
     */
    @JsonProperty(value = "sourceServerPassword", required = true)
    private String sourceServerPassword;

    /*
     * Password for target server.
     */
    @JsonProperty(value = "targetServerPassword", required = true)
    private String targetServerPassword;

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

    /**
     * Get the sourceServerPassword property: Password for source server.
     *
     * @return the sourceServerPassword value.
     */
    public String sourceServerPassword() {
        return this.sourceServerPassword;
    }

    /**
     * Set the sourceServerPassword property: Password for source server.
     *
     * @param sourceServerPassword the sourceServerPassword value to set.
     * @return the AdminCredentials object itself.
     */
    public AdminCredentials withSourceServerPassword(String sourceServerPassword) {
        this.sourceServerPassword = sourceServerPassword;
        return this;
    }

    /**
     * Get the targetServerPassword property: Password for target server.
     *
     * @return the targetServerPassword value.
     */
    public String targetServerPassword() {
        return this.targetServerPassword;
    }

    /**
     * Set the targetServerPassword property: Password for target server.
     *
     * @param targetServerPassword the targetServerPassword value to set.
     * @return the AdminCredentials object itself.
     */
    public AdminCredentials withTargetServerPassword(String targetServerPassword) {
        this.targetServerPassword = targetServerPassword;
        return this;
    }

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

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