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

package com.azure.resourcemanager.managementgroups.models;

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.managementgroups.fluent.models.CreateOrUpdateSettingsProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Parameters for creating or updating Management Group settings. */
@Fluent
public final class CreateOrUpdateSettingsRequest {
    /*
     * The properties of the request to create or update Management Group settings
     */
    @JsonProperty(value = "properties")
    private CreateOrUpdateSettingsProperties innerProperties;

    /** Creates an instance of CreateOrUpdateSettingsRequest class. */
    public CreateOrUpdateSettingsRequest() {
    }

    /**
     * Get the innerProperties property: The properties of the request to create or update Management Group settings.
     *
     * @return the innerProperties value.
     */
    private CreateOrUpdateSettingsProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the requireAuthorizationForGroupCreation property: Indicates whether RBAC access is required upon group
     * creation under the root Management Group. If set to true, user will require
     * Microsoft.Management/managementGroups/write action on the root Management Group scope in order to create new
     * Groups directly under the root. This will prevent new users from creating new Management Groups, unless they are
     * given access.
     *
     * @return the requireAuthorizationForGroupCreation value.
     */
    public Boolean requireAuthorizationForGroupCreation() {
        return this.innerProperties() == null ? null : this.innerProperties().requireAuthorizationForGroupCreation();
    }

    /**
     * Set the requireAuthorizationForGroupCreation property: Indicates whether RBAC access is required upon group
     * creation under the root Management Group. If set to true, user will require
     * Microsoft.Management/managementGroups/write action on the root Management Group scope in order to create new
     * Groups directly under the root. This will prevent new users from creating new Management Groups, unless they are
     * given access.
     *
     * @param requireAuthorizationForGroupCreation the requireAuthorizationForGroupCreation value to set.
     * @return the CreateOrUpdateSettingsRequest object itself.
     */
    public CreateOrUpdateSettingsRequest withRequireAuthorizationForGroupCreation(
        Boolean requireAuthorizationForGroupCreation) {
        if (this.innerProperties() == null) {
            this.innerProperties = new CreateOrUpdateSettingsProperties();
        }
        this.innerProperties().withRequireAuthorizationForGroupCreation(requireAuthorizationForGroupCreation);
        return this;
    }

    /**
     * Get the defaultManagementGroup property: Settings that sets the default Management Group under which new
     * subscriptions get added in this tenant. For example,
     * /providers/Microsoft.Management/managementGroups/defaultGroup.
     *
     * @return the defaultManagementGroup value.
     */
    public String defaultManagementGroup() {
        return this.innerProperties() == null ? null : this.innerProperties().defaultManagementGroup();
    }

    /**
     * Set the defaultManagementGroup property: Settings that sets the default Management Group under which new
     * subscriptions get added in this tenant. For example,
     * /providers/Microsoft.Management/managementGroups/defaultGroup.
     *
     * @param defaultManagementGroup the defaultManagementGroup value to set.
     * @return the CreateOrUpdateSettingsRequest object itself.
     */
    public CreateOrUpdateSettingsRequest withDefaultManagementGroup(String defaultManagementGroup) {
        if (this.innerProperties() == null) {
            this.innerProperties = new CreateOrUpdateSettingsProperties();
        }
        this.innerProperties().withDefaultManagementGroup(defaultManagementGroup);
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (innerProperties() != null) {
            innerProperties().validate();
        }
    }
}
