// 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.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.networkcloud.models.ConsoleDetailedStatus;
import com.azure.resourcemanager.networkcloud.models.ConsoleEnabled;
import com.azure.resourcemanager.networkcloud.models.ConsoleProvisioningState;
import com.azure.resourcemanager.networkcloud.models.SshPublicKey;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;

/** ConsoleProperties represents the properties of the virtual machine console. */
@Fluent
public final class ConsoleProperties {
    /*
     * The more detailed status of the console.
     */
    @JsonProperty(value = "detailedStatus", access = JsonProperty.Access.WRITE_ONLY)
    private ConsoleDetailedStatus detailedStatus;

    /*
     * The descriptive message about the current detailed status.
     */
    @JsonProperty(value = "detailedStatusMessage", access = JsonProperty.Access.WRITE_ONLY)
    private String detailedStatusMessage;

    /*
     * The indicator of whether the console access is enabled.
     */
    @JsonProperty(value = "enabled", required = true)
    private ConsoleEnabled enabled;

    /*
     * The date and time after which the key will be disallowed access.
     */
    @JsonProperty(value = "expiration")
    private OffsetDateTime expiration;

    /*
     * The resource ID of the private link service that is used to provide virtual machine console access.
     */
    @JsonProperty(value = "privateLinkServiceId", access = JsonProperty.Access.WRITE_ONLY)
    private String privateLinkServiceId;

    /*
     * The provisioning state of the virtual machine console.
     */
    @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
    private ConsoleProvisioningState provisioningState;

    /*
     * SshPublicKey represents the public key used to authenticate with a resource through SSH.
     *
     * The SSH public key that will be provisioned for user access. The user is expected to have the corresponding SSH
     * private key for logging in.
     */
    @JsonProperty(value = "sshPublicKey", required = true)
    private SshPublicKey sshPublicKey;

    /*
     * The unique identifier for the virtual machine that is used to access the console.
     */
    @JsonProperty(value = "virtualMachineAccessId", access = JsonProperty.Access.WRITE_ONLY)
    private String virtualMachineAccessId;

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

    /**
     * Get the detailedStatus property: The more detailed status of the console.
     *
     * @return the detailedStatus value.
     */
    public ConsoleDetailedStatus detailedStatus() {
        return this.detailedStatus;
    }

    /**
     * Get the detailedStatusMessage property: The descriptive message about the current detailed status.
     *
     * @return the detailedStatusMessage value.
     */
    public String detailedStatusMessage() {
        return this.detailedStatusMessage;
    }

    /**
     * Get the enabled property: The indicator of whether the console access is enabled.
     *
     * @return the enabled value.
     */
    public ConsoleEnabled enabled() {
        return this.enabled;
    }

    /**
     * Set the enabled property: The indicator of whether the console access is enabled.
     *
     * @param enabled the enabled value to set.
     * @return the ConsoleProperties object itself.
     */
    public ConsoleProperties withEnabled(ConsoleEnabled enabled) {
        this.enabled = enabled;
        return this;
    }

    /**
     * Get the expiration property: The date and time after which the key will be disallowed access.
     *
     * @return the expiration value.
     */
    public OffsetDateTime expiration() {
        return this.expiration;
    }

    /**
     * Set the expiration property: The date and time after which the key will be disallowed access.
     *
     * @param expiration the expiration value to set.
     * @return the ConsoleProperties object itself.
     */
    public ConsoleProperties withExpiration(OffsetDateTime expiration) {
        this.expiration = expiration;
        return this;
    }

    /**
     * Get the privateLinkServiceId property: The resource ID of the private link service that is used to provide
     * virtual machine console access.
     *
     * @return the privateLinkServiceId value.
     */
    public String privateLinkServiceId() {
        return this.privateLinkServiceId;
    }

    /**
     * Get the provisioningState property: The provisioning state of the virtual machine console.
     *
     * @return the provisioningState value.
     */
    public ConsoleProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the sshPublicKey property: SshPublicKey represents the public key used to authenticate with a resource
     * through SSH.
     *
     * <p>The SSH public key that will be provisioned for user access. The user is expected to have the corresponding
     * SSH private key for logging in.
     *
     * @return the sshPublicKey value.
     */
    public SshPublicKey sshPublicKey() {
        return this.sshPublicKey;
    }

    /**
     * Set the sshPublicKey property: SshPublicKey represents the public key used to authenticate with a resource
     * through SSH.
     *
     * <p>The SSH public key that will be provisioned for user access. The user is expected to have the corresponding
     * SSH private key for logging in.
     *
     * @param sshPublicKey the sshPublicKey value to set.
     * @return the ConsoleProperties object itself.
     */
    public ConsoleProperties withSshPublicKey(SshPublicKey sshPublicKey) {
        this.sshPublicKey = sshPublicKey;
        return this;
    }

    /**
     * Get the virtualMachineAccessId property: The unique identifier for the virtual machine that is used to access the
     * console.
     *
     * @return the virtualMachineAccessId value.
     */
    public String virtualMachineAccessId() {
        return this.virtualMachineAccessId;
    }

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

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