// 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.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;

/** The details of a management group used during creation. */
@Fluent
public final class CreateManagementGroupDetails {
    /*
     * The version number of the object.
     */
    @JsonProperty(value = "version", access = JsonProperty.Access.WRITE_ONLY)
    private Integer version;

    /*
     * The date and time when this object was last updated.
     */
    @JsonProperty(value = "updatedTime", access = JsonProperty.Access.WRITE_ONLY)
    private OffsetDateTime updatedTime;

    /*
     * The identity of the principal or process that updated the object.
     */
    @JsonProperty(value = "updatedBy", access = JsonProperty.Access.WRITE_ONLY)
    private String updatedBy;

    /*
     * (Optional) The ID of the parent management group used during creation.
     */
    @JsonProperty(value = "parent")
    private CreateParentGroupInfo parent;

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

    /**
     * Get the version property: The version number of the object.
     *
     * @return the version value.
     */
    public Integer version() {
        return this.version;
    }

    /**
     * Get the updatedTime property: The date and time when this object was last updated.
     *
     * @return the updatedTime value.
     */
    public OffsetDateTime updatedTime() {
        return this.updatedTime;
    }

    /**
     * Get the updatedBy property: The identity of the principal or process that updated the object.
     *
     * @return the updatedBy value.
     */
    public String updatedBy() {
        return this.updatedBy;
    }

    /**
     * Get the parent property: (Optional) The ID of the parent management group used during creation.
     *
     * @return the parent value.
     */
    public CreateParentGroupInfo parent() {
        return this.parent;
    }

    /**
     * Set the parent property: (Optional) The ID of the parent management group used during creation.
     *
     * @param parent the parent value to set.
     * @return the CreateManagementGroupDetails object itself.
     */
    public CreateManagementGroupDetails withParent(CreateParentGroupInfo parent) {
        this.parent = parent;
        return this;
    }

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