// 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.resourcemanager.networkcloud.models.ConsoleEnabled;
import com.azure.resourcemanager.networkcloud.models.SshPublicKey;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;

/** ConsolePatchProperties represents the properties of the virtual machine console that can be patched. */
@Fluent
public final class ConsolePatchProperties {
    /*
     * The credentials used to login to the image repository that has access to the specified image.
     */
    @JsonProperty(value = "enabled")
    private ConsoleEnabled enabled;

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

    /*
     * 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")
    private SshPublicKey sshPublicKey;

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

    /**
     * Get the enabled property: The credentials used to login to the image repository that has access to the specified
     * image.
     *
     * @return the enabled value.
     */
    public ConsoleEnabled enabled() {
        return this.enabled;
    }

    /**
     * Set the enabled property: The credentials used to login to the image repository that has access to the specified
     * image.
     *
     * @param enabled the enabled value to set.
     * @return the ConsolePatchProperties object itself.
     */
    public ConsolePatchProperties 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 ConsolePatchProperties object itself.
     */
    public ConsolePatchProperties withExpiration(OffsetDateTime expiration) {
        this.expiration = expiration;
        return this;
    }

    /**
     * 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 ConsolePatchProperties object itself.
     */
    public ConsolePatchProperties withSshPublicKey(SshPublicKey sshPublicKey) {
        this.sshPublicKey = sshPublicKey;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (sshPublicKey() != null) {
            sshPublicKey().validate();
        }
    }
}
