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

package com.azure.resourcemanager.labservices.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.labservices.models.AutoShutdownProfile;
import com.azure.resourcemanager.labservices.models.ConnectionProfile;
import com.azure.resourcemanager.labservices.models.Identity;
import com.azure.resourcemanager.labservices.models.LabPlanNetworkProfile;
import com.azure.resourcemanager.labservices.models.ProvisioningState;
import com.azure.resourcemanager.labservices.models.SupportInfo;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.Map;

/**
 * Lab Plans act as a permission container for creating labs via labs.azure.com. Additionally, they can provide a set of
 * default configurations that will apply at the time of creating a lab, but these defaults can still be overwritten.
 */
@Fluent
public final class LabPlanInner extends Resource {
    /*
     * Metadata pertaining to creation and last modification of the lab plan.
     */
    @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY)
    private SystemData systemData;

    /*
     * Lab plan resource properties
     */
    @JsonProperty(value = "properties", required = true)
    private LabPlanProperties innerProperties = new LabPlanProperties();

    /*
     * Managed Identity Information
     */
    @JsonProperty(value = "identity")
    private Identity identity;

    /**
     * Get the systemData property: Metadata pertaining to creation and last modification of the lab plan.
     *
     * @return the systemData value.
     */
    public SystemData systemData() {
        return this.systemData;
    }

    /**
     * Get the innerProperties property: Lab plan resource properties.
     *
     * @return the innerProperties value.
     */
    private LabPlanProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the identity property: Managed Identity Information.
     *
     * @return the identity value.
     */
    public Identity identity() {
        return this.identity;
    }

    /**
     * Set the identity property: Managed Identity Information.
     *
     * @param identity the identity value to set.
     * @return the LabPlanInner object itself.
     */
    public LabPlanInner withIdentity(Identity identity) {
        this.identity = identity;
        return this;
    }

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

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

    /**
     * Get the provisioningState property: Current provisioning state of the lab plan.
     *
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the defaultConnectionProfile property: The default lab connection profile. This can be changed on a lab
     * resource and only provides a default profile.
     *
     * @return the defaultConnectionProfile value.
     */
    public ConnectionProfile defaultConnectionProfile() {
        return this.innerProperties() == null ? null : this.innerProperties().defaultConnectionProfile();
    }

    /**
     * Set the defaultConnectionProfile property: The default lab connection profile. This can be changed on a lab
     * resource and only provides a default profile.
     *
     * @param defaultConnectionProfile the defaultConnectionProfile value to set.
     * @return the LabPlanInner object itself.
     */
    public LabPlanInner withDefaultConnectionProfile(ConnectionProfile defaultConnectionProfile) {
        if (this.innerProperties() == null) {
            this.innerProperties = new LabPlanProperties();
        }
        this.innerProperties().withDefaultConnectionProfile(defaultConnectionProfile);
        return this;
    }

    /**
     * Get the defaultAutoShutdownProfile property: The default lab shutdown profile. This can be changed on a lab
     * resource and only provides a default profile.
     *
     * @return the defaultAutoShutdownProfile value.
     */
    public AutoShutdownProfile defaultAutoShutdownProfile() {
        return this.innerProperties() == null ? null : this.innerProperties().defaultAutoShutdownProfile();
    }

    /**
     * Set the defaultAutoShutdownProfile property: The default lab shutdown profile. This can be changed on a lab
     * resource and only provides a default profile.
     *
     * @param defaultAutoShutdownProfile the defaultAutoShutdownProfile value to set.
     * @return the LabPlanInner object itself.
     */
    public LabPlanInner withDefaultAutoShutdownProfile(AutoShutdownProfile defaultAutoShutdownProfile) {
        if (this.innerProperties() == null) {
            this.innerProperties = new LabPlanProperties();
        }
        this.innerProperties().withDefaultAutoShutdownProfile(defaultAutoShutdownProfile);
        return this;
    }

    /**
     * Get the defaultNetworkProfile property: The lab plan network profile. To enforce lab network policies they must
     * be defined here and cannot be changed when there are existing labs associated with this lab plan.
     *
     * @return the defaultNetworkProfile value.
     */
    public LabPlanNetworkProfile defaultNetworkProfile() {
        return this.innerProperties() == null ? null : this.innerProperties().defaultNetworkProfile();
    }

    /**
     * Set the defaultNetworkProfile property: The lab plan network profile. To enforce lab network policies they must
     * be defined here and cannot be changed when there are existing labs associated with this lab plan.
     *
     * @param defaultNetworkProfile the defaultNetworkProfile value to set.
     * @return the LabPlanInner object itself.
     */
    public LabPlanInner withDefaultNetworkProfile(LabPlanNetworkProfile defaultNetworkProfile) {
        if (this.innerProperties() == null) {
            this.innerProperties = new LabPlanProperties();
        }
        this.innerProperties().withDefaultNetworkProfile(defaultNetworkProfile);
        return this;
    }

    /**
     * Get the allowedRegions property: The allowed regions for the lab creator to use when creating labs using this lab
     * plan.
     *
     * @return the allowedRegions value.
     */
    public List<String> allowedRegions() {
        return this.innerProperties() == null ? null : this.innerProperties().allowedRegions();
    }

    /**
     * Set the allowedRegions property: The allowed regions for the lab creator to use when creating labs using this lab
     * plan.
     *
     * @param allowedRegions the allowedRegions value to set.
     * @return the LabPlanInner object itself.
     */
    public LabPlanInner withAllowedRegions(List<String> allowedRegions) {
        if (this.innerProperties() == null) {
            this.innerProperties = new LabPlanProperties();
        }
        this.innerProperties().withAllowedRegions(allowedRegions);
        return this;
    }

    /**
     * Get the sharedGalleryId property: Resource ID of the Shared Image Gallery attached to this lab plan. When saving
     * a lab template virtual machine image it will be persisted in this gallery. Shared images from the gallery can be
     * made available to use when creating new labs.
     *
     * @return the sharedGalleryId value.
     */
    public String sharedGalleryId() {
        return this.innerProperties() == null ? null : this.innerProperties().sharedGalleryId();
    }

    /**
     * Set the sharedGalleryId property: Resource ID of the Shared Image Gallery attached to this lab plan. When saving
     * a lab template virtual machine image it will be persisted in this gallery. Shared images from the gallery can be
     * made available to use when creating new labs.
     *
     * @param sharedGalleryId the sharedGalleryId value to set.
     * @return the LabPlanInner object itself.
     */
    public LabPlanInner withSharedGalleryId(String sharedGalleryId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new LabPlanProperties();
        }
        this.innerProperties().withSharedGalleryId(sharedGalleryId);
        return this;
    }

    /**
     * Get the supportInfo property: Support contact information and instructions for users of the lab plan. This
     * information is displayed to lab owners and virtual machine users for all labs in the lab plan.
     *
     * @return the supportInfo value.
     */
    public SupportInfo supportInfo() {
        return this.innerProperties() == null ? null : this.innerProperties().supportInfo();
    }

    /**
     * Set the supportInfo property: Support contact information and instructions for users of the lab plan. This
     * information is displayed to lab owners and virtual machine users for all labs in the lab plan.
     *
     * @param supportInfo the supportInfo value to set.
     * @return the LabPlanInner object itself.
     */
    public LabPlanInner withSupportInfo(SupportInfo supportInfo) {
        if (this.innerProperties() == null) {
            this.innerProperties = new LabPlanProperties();
        }
        this.innerProperties().withSupportInfo(supportInfo);
        return this;
    }

    /**
     * Get the linkedLmsInstance property: Base Url of the lms instance this lab plan can link lab rosters against.
     *
     * @return the linkedLmsInstance value.
     */
    public String linkedLmsInstance() {
        return this.innerProperties() == null ? null : this.innerProperties().linkedLmsInstance();
    }

    /**
     * Set the linkedLmsInstance property: Base Url of the lms instance this lab plan can link lab rosters against.
     *
     * @param linkedLmsInstance the linkedLmsInstance value to set.
     * @return the LabPlanInner object itself.
     */
    public LabPlanInner withLinkedLmsInstance(String linkedLmsInstance) {
        if (this.innerProperties() == null) {
            this.innerProperties = new LabPlanProperties();
        }
        this.innerProperties().withLinkedLmsInstance(linkedLmsInstance);
        return this;
    }

    /**
     * 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 LabPlanInner"));
        } else {
            innerProperties().validate();
        }
        if (identity() != null) {
            identity().validate();
        }
    }

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