// 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.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.managementgroups.models.EntityHierarchyItem;
import com.azure.resourcemanager.managementgroups.models.Permissions;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** The generic properties of a management group. */
@Fluent
public final class EntityHierarchyItemProperties {
    /*
     * The friendly name of the management group.
     */
    @JsonProperty(value = "displayName")
    private String displayName;

    /*
     * The users specific permissions to this item.
     */
    @JsonProperty(value = "permissions")
    private Permissions permissions;

    /*
     * The list of children.
     */
    @JsonProperty(value = "children")
    private List<EntityHierarchyItem> children;

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

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

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

    /**
     * Get the permissions property: The users specific permissions to this item.
     *
     * @return the permissions value.
     */
    public Permissions permissions() {
        return this.permissions;
    }

    /**
     * Set the permissions property: The users specific permissions to this item.
     *
     * @param permissions the permissions value to set.
     * @return the EntityHierarchyItemProperties object itself.
     */
    public EntityHierarchyItemProperties withPermissions(Permissions permissions) {
        this.permissions = permissions;
        return this;
    }

    /**
     * Get the children property: The list of children.
     *
     * @return the children value.
     */
    public List<EntityHierarchyItem> children() {
        return this.children;
    }

    /**
     * Set the children property: The list of children.
     *
     * @param children the children value to set.
     * @return the EntityHierarchyItemProperties object itself.
     */
    public EntityHierarchyItemProperties withChildren(List<EntityHierarchyItem> children) {
        this.children = children;
        return this;
    }

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