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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.connectedvmware.models.ResourceStatus;
import com.azure.resourcemanager.connectedvmware.models.VICredential;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Defines the resource properties. */
@Fluent
public final class VCenterProperties {
    /*
     * Gets or sets a unique identifier for this resource.
     */
    @JsonProperty(value = "uuid", access = JsonProperty.Access.WRITE_ONLY)
    private String uuid;

    /*
     * Gets or sets the FQDN/IPAddress of the vCenter.
     */
    @JsonProperty(value = "fqdn", required = true)
    private String fqdn;

    /*
     * Gets or sets the port of the vCenter.
     */
    @JsonProperty(value = "port")
    private Integer port;

    /*
     * Gets or sets the version of the vCenter.
     */
    @JsonProperty(value = "version", access = JsonProperty.Access.WRITE_ONLY)
    private String version;

    /*
     * Gets or sets the instance UUID of the vCenter.
     */
    @JsonProperty(value = "instanceUuid", access = JsonProperty.Access.WRITE_ONLY)
    private String instanceUuid;

    /*
     * Gets or sets the connection status to the vCenter.
     */
    @JsonProperty(value = "connectionStatus", access = JsonProperty.Access.WRITE_ONLY)
    private String connectionStatus;

    /*
     * Gets the name of the corresponding resource in Kubernetes.
     */
    @JsonProperty(value = "customResourceName", access = JsonProperty.Access.WRITE_ONLY)
    private String customResourceName;

    /*
     * Username / Password Credentials to connect to vcenter.
     */
    @JsonProperty(value = "credentials")
    private VICredential credentials;

    /*
     * The resource status information.
     */
    @JsonProperty(value = "statuses", access = JsonProperty.Access.WRITE_ONLY)
    private List<ResourceStatus> statuses;

    /*
     * Gets or sets the provisioning state.
     */
    @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
    private String provisioningState;

    /**
     * Get the uuid property: Gets or sets a unique identifier for this resource.
     *
     * @return the uuid value.
     */
    public String uuid() {
        return this.uuid;
    }

    /**
     * Get the fqdn property: Gets or sets the FQDN/IPAddress of the vCenter.
     *
     * @return the fqdn value.
     */
    public String fqdn() {
        return this.fqdn;
    }

    /**
     * Set the fqdn property: Gets or sets the FQDN/IPAddress of the vCenter.
     *
     * @param fqdn the fqdn value to set.
     * @return the VCenterProperties object itself.
     */
    public VCenterProperties withFqdn(String fqdn) {
        this.fqdn = fqdn;
        return this;
    }

    /**
     * Get the port property: Gets or sets the port of the vCenter.
     *
     * @return the port value.
     */
    public Integer port() {
        return this.port;
    }

    /**
     * Set the port property: Gets or sets the port of the vCenter.
     *
     * @param port the port value to set.
     * @return the VCenterProperties object itself.
     */
    public VCenterProperties withPort(Integer port) {
        this.port = port;
        return this;
    }

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

    /**
     * Get the instanceUuid property: Gets or sets the instance UUID of the vCenter.
     *
     * @return the instanceUuid value.
     */
    public String instanceUuid() {
        return this.instanceUuid;
    }

    /**
     * Get the connectionStatus property: Gets or sets the connection status to the vCenter.
     *
     * @return the connectionStatus value.
     */
    public String connectionStatus() {
        return this.connectionStatus;
    }

    /**
     * Get the customResourceName property: Gets the name of the corresponding resource in Kubernetes.
     *
     * @return the customResourceName value.
     */
    public String customResourceName() {
        return this.customResourceName;
    }

    /**
     * Get the credentials property: Username / Password Credentials to connect to vcenter.
     *
     * @return the credentials value.
     */
    public VICredential credentials() {
        return this.credentials;
    }

    /**
     * Set the credentials property: Username / Password Credentials to connect to vcenter.
     *
     * @param credentials the credentials value to set.
     * @return the VCenterProperties object itself.
     */
    public VCenterProperties withCredentials(VICredential credentials) {
        this.credentials = credentials;
        return this;
    }

    /**
     * Get the statuses property: The resource status information.
     *
     * @return the statuses value.
     */
    public List<ResourceStatus> statuses() {
        return this.statuses;
    }

    /**
     * Get the provisioningState property: Gets or sets the provisioning state.
     *
     * @return the provisioningState value.
     */
    public String provisioningState() {
        return this.provisioningState;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (fqdn() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property fqdn in model VCenterProperties"));
        }
        if (credentials() != null) {
            credentials().validate();
        }
        if (statuses() != null) {
            statuses().forEach(e -> e.validate());
        }
    }

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