// 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.DescendantParentGroupInfo;
import com.fasterxml.jackson.annotation.JsonProperty;

/** The descendant. */
@Fluent
public final class DescendantInfoInner {
    /*
     * The fully qualified ID for the descendant.  For example,
     * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 or
     * /subscriptions/0000000-0000-0000-0000-000000000000
     */
    @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY)
    private String id;

    /*
     * The type of the resource. For example, Microsoft.Management/managementGroups or /subscriptions
     */
    @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY)
    private String type;

    /*
     * The name of the descendant. For example, 00000000-0000-0000-0000-000000000000
     */
    @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY)
    private String name;

    /*
     * The generic properties of an descendant.
     */
    @JsonProperty(value = "properties")
    private DescendantInfoProperties innerProperties;

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

    /**
     * Get the id property: The fully qualified ID for the descendant. For example,
     * /providers/Microsoft.Management/managementGroups/0000000-0000-0000-0000-000000000000 or
     * /subscriptions/0000000-0000-0000-0000-000000000000.
     *
     * @return the id value.
     */
    public String id() {
        return this.id;
    }

    /**
     * Get the type property: The type of the resource. For example, Microsoft.Management/managementGroups or
     * /subscriptions.
     *
     * @return the type value.
     */
    public String type() {
        return this.type;
    }

    /**
     * Get the name property: The name of the descendant. For example, 00000000-0000-0000-0000-000000000000.
     *
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Get the innerProperties property: The generic properties of an descendant.
     *
     * @return the innerProperties value.
     */
    private DescendantInfoProperties innerProperties() {
        return this.innerProperties;
    }

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

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

    /**
     * Get the parent property: The ID of the parent management group.
     *
     * @return the parent value.
     */
    public DescendantParentGroupInfo parent() {
        return this.innerProperties() == null ? null : this.innerProperties().parent();
    }

    /**
     * Set the parent property: The ID of the parent management group.
     *
     * @param parent the parent value to set.
     * @return the DescendantInfoInner object itself.
     */
    public DescendantInfoInner withParent(DescendantParentGroupInfo parent) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DescendantInfoProperties();
        }
        this.innerProperties().withParent(parent);
        return this;
    }

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