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

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

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.iotcentral.models.AppState;
import com.azure.resourcemanager.iotcentral.models.NetworkRuleSets;
import com.azure.resourcemanager.iotcentral.models.ProvisioningState;
import com.azure.resourcemanager.iotcentral.models.PublicNetworkAccess;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** The properties of an IoT Central application. */
@Fluent
public final class AppProperties {
    /*
     * The provisioning state of the application.
     */
    @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
    private ProvisioningState provisioningState;

    /*
     * The ID of the application.
     */
    @JsonProperty(value = "applicationId", access = JsonProperty.Access.WRITE_ONLY)
    private String applicationId;

    /*
     * The display name of the application.
     */
    @JsonProperty(value = "displayName")
    private String displayName;

    /*
     * The subdomain of the application.
     */
    @JsonProperty(value = "subdomain")
    private String subdomain;

    /*
     * The ID of the application template, which is a blueprint that defines
     * the characteristics and behaviors of an application. Optional; if not
     * specified, defaults to a blank blueprint and allows the application to
     * be defined from scratch.
     */
    @JsonProperty(value = "template")
    private String template;

    /*
     * The current state of the application.
     */
    @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY)
    private AppState state;

    /*
     * Whether requests from the public network are allowed.
     */
    @JsonProperty(value = "publicNetworkAccess")
    private PublicNetworkAccess publicNetworkAccess;

    /*
     * Network Rule Set Properties of this IoT Central application.
     */
    @JsonProperty(value = "networkRuleSets")
    private NetworkRuleSets networkRuleSets;

    /*
     * Private endpoint connections created on this IoT Central application.
     */
    @JsonProperty(value = "privateEndpointConnections", access = JsonProperty.Access.WRITE_ONLY)
    private List<PrivateEndpointConnectionInner> privateEndpointConnections;

    /**
     * Get the provisioningState property: The provisioning state of the application.
     *
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the applicationId property: The ID of the application.
     *
     * @return the applicationId value.
     */
    public String applicationId() {
        return this.applicationId;
    }

    /**
     * Get the displayName property: The display name of the application.
     *
     * @return the displayName value.
     */
    public String displayName() {
        return this.displayName;
    }

    /**
     * Set the displayName property: The display name of the application.
     *
     * @param displayName the displayName value to set.
     * @return the AppProperties object itself.
     */
    public AppProperties withDisplayName(String displayName) {
        this.displayName = displayName;
        return this;
    }

    /**
     * Get the subdomain property: The subdomain of the application.
     *
     * @return the subdomain value.
     */
    public String subdomain() {
        return this.subdomain;
    }

    /**
     * Set the subdomain property: The subdomain of the application.
     *
     * @param subdomain the subdomain value to set.
     * @return the AppProperties object itself.
     */
    public AppProperties withSubdomain(String subdomain) {
        this.subdomain = subdomain;
        return this;
    }

    /**
     * Get the template property: The ID of the application template, which is a blueprint that defines the
     * characteristics and behaviors of an application. Optional; if not specified, defaults to a blank blueprint and
     * allows the application to be defined from scratch.
     *
     * @return the template value.
     */
    public String template() {
        return this.template;
    }

    /**
     * Set the template property: The ID of the application template, which is a blueprint that defines the
     * characteristics and behaviors of an application. Optional; if not specified, defaults to a blank blueprint and
     * allows the application to be defined from scratch.
     *
     * @param template the template value to set.
     * @return the AppProperties object itself.
     */
    public AppProperties withTemplate(String template) {
        this.template = template;
        return this;
    }

    /**
     * Get the state property: The current state of the application.
     *
     * @return the state value.
     */
    public AppState state() {
        return this.state;
    }

    /**
     * Get the publicNetworkAccess property: Whether requests from the public network are allowed.
     *
     * @return the publicNetworkAccess value.
     */
    public PublicNetworkAccess publicNetworkAccess() {
        return this.publicNetworkAccess;
    }

    /**
     * Set the publicNetworkAccess property: Whether requests from the public network are allowed.
     *
     * @param publicNetworkAccess the publicNetworkAccess value to set.
     * @return the AppProperties object itself.
     */
    public AppProperties withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) {
        this.publicNetworkAccess = publicNetworkAccess;
        return this;
    }

    /**
     * Get the networkRuleSets property: Network Rule Set Properties of this IoT Central application.
     *
     * @return the networkRuleSets value.
     */
    public NetworkRuleSets networkRuleSets() {
        return this.networkRuleSets;
    }

    /**
     * Set the networkRuleSets property: Network Rule Set Properties of this IoT Central application.
     *
     * @param networkRuleSets the networkRuleSets value to set.
     * @return the AppProperties object itself.
     */
    public AppProperties withNetworkRuleSets(NetworkRuleSets networkRuleSets) {
        this.networkRuleSets = networkRuleSets;
        return this;
    }

    /**
     * Get the privateEndpointConnections property: Private endpoint connections created on this IoT Central
     * application.
     *
     * @return the privateEndpointConnections value.
     */
    public List<PrivateEndpointConnectionInner> privateEndpointConnections() {
        return this.privateEndpointConnections;
    }

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