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

package com.azure.resourcemanager.networkcloud.models;

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

/**
 * AdministrativeCredentials represents the admin credentials for the device requiring password-based authentication.
 */
@Fluent
public final class AdministrativeCredentials {
    /*
     * The password of the administrator of the device used during initialization.
     */
    @JsonProperty(value = "password", required = true)
    private String password;

    /*
     * The username of the administrator of the device used during initialization.
     */
    @JsonProperty(value = "username", required = true)
    private String username;

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

    /**
     * Get the password property: The password of the administrator of the device used during initialization.
     *
     * @return the password value.
     */
    public String password() {
        return this.password;
    }

    /**
     * Set the password property: The password of the administrator of the device used during initialization.
     *
     * @param password the password value to set.
     * @return the AdministrativeCredentials object itself.
     */
    public AdministrativeCredentials withPassword(String password) {
        this.password = password;
        return this;
    }

    /**
     * Get the username property: The username of the administrator of the device used during initialization.
     *
     * @return the username value.
     */
    public String username() {
        return this.username;
    }

    /**
     * Set the username property: The username of the administrator of the device used during initialization.
     *
     * @param username the username value to set.
     * @return the AdministrativeCredentials object itself.
     */
    public AdministrativeCredentials withUsername(String username) {
        this.username = username;
        return this;
    }

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

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