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

package com.azure.resourcemanager.automation.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.automation.models.DscNodeExtensionHandlerAssociationProperty;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.List;

/** The properties of a DscNode. */
@Fluent
public final class DscNodeProperties {
    /*
     * Gets or sets the last seen time of the node.
     */
    @JsonProperty(value = "lastSeen")
    private OffsetDateTime lastSeen;

    /*
     * Gets or sets the registration time of the node.
     */
    @JsonProperty(value = "registrationTime")
    private OffsetDateTime registrationTime;

    /*
     * Gets or sets the ip of the node.
     */
    @JsonProperty(value = "ip")
    private String ip;

    /*
     * Gets or sets the account id of the node.
     */
    @JsonProperty(value = "accountId")
    private String accountId;

    /*
     * Gets or sets the configuration of the node.
     */
    @JsonProperty(value = "nodeConfiguration")
    private DscNodeConfigurationAssociationProperty innerNodeConfiguration;

    /*
     * Gets or sets the status of the node.
     */
    @JsonProperty(value = "status")
    private String status;

    /*
     * Gets or sets the node id.
     */
    @JsonProperty(value = "nodeId")
    private String nodeId;

    /*
     * Gets or sets the etag of the resource.
     */
    @JsonProperty(value = "etag")
    private String etag;

    /*
     * Gets the total number of records matching filter criteria.
     */
    @JsonProperty(value = "totalCount")
    private Integer totalCount;

    /*
     * Gets or sets the list of extensionHandler properties for a Node.
     */
    @JsonProperty(value = "extensionHandler")
    private List<DscNodeExtensionHandlerAssociationProperty> extensionHandler;

    /**
     * Get the lastSeen property: Gets or sets the last seen time of the node.
     *
     * @return the lastSeen value.
     */
    public OffsetDateTime lastSeen() {
        return this.lastSeen;
    }

    /**
     * Set the lastSeen property: Gets or sets the last seen time of the node.
     *
     * @param lastSeen the lastSeen value to set.
     * @return the DscNodeProperties object itself.
     */
    public DscNodeProperties withLastSeen(OffsetDateTime lastSeen) {
        this.lastSeen = lastSeen;
        return this;
    }

    /**
     * Get the registrationTime property: Gets or sets the registration time of the node.
     *
     * @return the registrationTime value.
     */
    public OffsetDateTime registrationTime() {
        return this.registrationTime;
    }

    /**
     * Set the registrationTime property: Gets or sets the registration time of the node.
     *
     * @param registrationTime the registrationTime value to set.
     * @return the DscNodeProperties object itself.
     */
    public DscNodeProperties withRegistrationTime(OffsetDateTime registrationTime) {
        this.registrationTime = registrationTime;
        return this;
    }

    /**
     * Get the ip property: Gets or sets the ip of the node.
     *
     * @return the ip value.
     */
    public String ip() {
        return this.ip;
    }

    /**
     * Set the ip property: Gets or sets the ip of the node.
     *
     * @param ip the ip value to set.
     * @return the DscNodeProperties object itself.
     */
    public DscNodeProperties withIp(String ip) {
        this.ip = ip;
        return this;
    }

    /**
     * Get the accountId property: Gets or sets the account id of the node.
     *
     * @return the accountId value.
     */
    public String accountId() {
        return this.accountId;
    }

    /**
     * Set the accountId property: Gets or sets the account id of the node.
     *
     * @param accountId the accountId value to set.
     * @return the DscNodeProperties object itself.
     */
    public DscNodeProperties withAccountId(String accountId) {
        this.accountId = accountId;
        return this;
    }

    /**
     * Get the innerNodeConfiguration property: Gets or sets the configuration of the node.
     *
     * @return the innerNodeConfiguration value.
     */
    private DscNodeConfigurationAssociationProperty innerNodeConfiguration() {
        return this.innerNodeConfiguration;
    }

    /**
     * Get the status property: Gets or sets the status of the node.
     *
     * @return the status value.
     */
    public String status() {
        return this.status;
    }

    /**
     * Set the status property: Gets or sets the status of the node.
     *
     * @param status the status value to set.
     * @return the DscNodeProperties object itself.
     */
    public DscNodeProperties withStatus(String status) {
        this.status = status;
        return this;
    }

    /**
     * Get the nodeId property: Gets or sets the node id.
     *
     * @return the nodeId value.
     */
    public String nodeId() {
        return this.nodeId;
    }

    /**
     * Set the nodeId property: Gets or sets the node id.
     *
     * @param nodeId the nodeId value to set.
     * @return the DscNodeProperties object itself.
     */
    public DscNodeProperties withNodeId(String nodeId) {
        this.nodeId = nodeId;
        return this;
    }

    /**
     * Get the etag property: Gets or sets the etag of the resource.
     *
     * @return the etag value.
     */
    public String etag() {
        return this.etag;
    }

    /**
     * Set the etag property: Gets or sets the etag of the resource.
     *
     * @param etag the etag value to set.
     * @return the DscNodeProperties object itself.
     */
    public DscNodeProperties withEtag(String etag) {
        this.etag = etag;
        return this;
    }

    /**
     * Get the totalCount property: Gets the total number of records matching filter criteria.
     *
     * @return the totalCount value.
     */
    public Integer totalCount() {
        return this.totalCount;
    }

    /**
     * Set the totalCount property: Gets the total number of records matching filter criteria.
     *
     * @param totalCount the totalCount value to set.
     * @return the DscNodeProperties object itself.
     */
    public DscNodeProperties withTotalCount(Integer totalCount) {
        this.totalCount = totalCount;
        return this;
    }

    /**
     * Get the extensionHandler property: Gets or sets the list of extensionHandler properties for a Node.
     *
     * @return the extensionHandler value.
     */
    public List<DscNodeExtensionHandlerAssociationProperty> extensionHandler() {
        return this.extensionHandler;
    }

    /**
     * Set the extensionHandler property: Gets or sets the list of extensionHandler properties for a Node.
     *
     * @param extensionHandler the extensionHandler value to set.
     * @return the DscNodeProperties object itself.
     */
    public DscNodeProperties withExtensionHandler(List<DscNodeExtensionHandlerAssociationProperty> extensionHandler) {
        this.extensionHandler = extensionHandler;
        return this;
    }

    /**
     * Get the name property: Gets or sets the name of the dsc node configuration.
     *
     * @return the name value.
     */
    public String name() {
        return this.innerNodeConfiguration() == null ? null : this.innerNodeConfiguration().name();
    }

    /**
     * Set the name property: Gets or sets the name of the dsc node configuration.
     *
     * @param name the name value to set.
     * @return the DscNodeProperties object itself.
     */
    public DscNodeProperties withName(String name) {
        if (this.innerNodeConfiguration() == null) {
            this.innerNodeConfiguration = new DscNodeConfigurationAssociationProperty();
        }
        this.innerNodeConfiguration().withName(name);
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (innerNodeConfiguration() != null) {
            innerNodeConfiguration().validate();
        }
        if (extensionHandler() != null) {
            extensionHandler().forEach(e -> e.validate());
        }
    }
}
