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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.core.management.SystemData;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.scvmm.models.ExtendedLocation;
import com.azure.resourcemanager.scvmm.models.VmmServerPropertiesCredentials;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;

/** The VmmServers resource definition. */
@Fluent
public final class VmmServerInner extends Resource {
    /*
     * Resource properties.
     */
    @JsonProperty(value = "properties", required = true)
    private VmmServerProperties innerProperties = new VmmServerProperties();

    /*
     * The system data.
     */
    @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY)
    private SystemData systemData;

    /*
     * The extended location.
     */
    @JsonProperty(value = "extendedLocation", required = true)
    private ExtendedLocation extendedLocation;

    /**
     * Get the innerProperties property: Resource properties.
     *
     * @return the innerProperties value.
     */
    private VmmServerProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the systemData property: The system data.
     *
     * @return the systemData value.
     */
    public SystemData systemData() {
        return this.systemData;
    }

    /**
     * Get the extendedLocation property: The extended location.
     *
     * @return the extendedLocation value.
     */
    public ExtendedLocation extendedLocation() {
        return this.extendedLocation;
    }

    /**
     * Set the extendedLocation property: The extended location.
     *
     * @param extendedLocation the extendedLocation value to set.
     * @return the VmmServerInner object itself.
     */
    public VmmServerInner withExtendedLocation(ExtendedLocation extendedLocation) {
        this.extendedLocation = extendedLocation;
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public VmmServerInner withLocation(String location) {
        super.withLocation(location);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public VmmServerInner withTags(Map<String, String> tags) {
        super.withTags(tags);
        return this;
    }

    /**
     * Get the credentials property: Credentials to connect to VMMServer.
     *
     * @return the credentials value.
     */
    public VmmServerPropertiesCredentials credentials() {
        return this.innerProperties() == null ? null : this.innerProperties().credentials();
    }

    /**
     * Set the credentials property: Credentials to connect to VMMServer.
     *
     * @param credentials the credentials value to set.
     * @return the VmmServerInner object itself.
     */
    public VmmServerInner withCredentials(VmmServerPropertiesCredentials credentials) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VmmServerProperties();
        }
        this.innerProperties().withCredentials(credentials);
        return this;
    }

    /**
     * Get the fqdn property: Fqdn is the hostname/ip of the vmmServer.
     *
     * @return the fqdn value.
     */
    public String fqdn() {
        return this.innerProperties() == null ? null : this.innerProperties().fqdn();
    }

    /**
     * Set the fqdn property: Fqdn is the hostname/ip of the vmmServer.
     *
     * @param fqdn the fqdn value to set.
     * @return the VmmServerInner object itself.
     */
    public VmmServerInner withFqdn(String fqdn) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VmmServerProperties();
        }
        this.innerProperties().withFqdn(fqdn);
        return this;
    }

    /**
     * Get the port property: Port is the port on which the vmmServer is listening.
     *
     * @return the port value.
     */
    public Integer port() {
        return this.innerProperties() == null ? null : this.innerProperties().port();
    }

    /**
     * Set the port property: Port is the port on which the vmmServer is listening.
     *
     * @param port the port value to set.
     * @return the VmmServerInner object itself.
     */
    public VmmServerInner withPort(Integer port) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VmmServerProperties();
        }
        this.innerProperties().withPort(port);
        return this;
    }

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

    /**
     * Get the errorMessage property: Gets or sets any error message if connection to vmmServer is having any issue.
     *
     * @return the errorMessage value.
     */
    public String errorMessage() {
        return this.innerProperties() == null ? null : this.innerProperties().errorMessage();
    }

    /**
     * Get the uuid property: Unique ID of vmmServer.
     *
     * @return the uuid value.
     */
    public String uuid() {
        return this.innerProperties() == null ? null : this.innerProperties().uuid();
    }

    /**
     * Get the version property: Version is the version of the vmmSever.
     *
     * @return the version value.
     */
    public String version() {
        return this.innerProperties() == null ? null : this.innerProperties().version();
    }

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

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

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