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

package com.azure.resourcemanager.apimanagement.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.ProxyResource;
import com.azure.resourcemanager.apimanagement.models.GroupType;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Contract details. */
@Fluent
public final class GroupContractInner extends ProxyResource {
    /*
     * Group entity contract properties.
     */
    @JsonProperty(value = "properties")
    private GroupContractProperties innerProperties;

    /**
     * Get the innerProperties property: Group entity contract properties.
     *
     * @return the innerProperties value.
     */
    private GroupContractProperties innerProperties() {
        return this.innerProperties;
    }

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

    /**
     * Set the displayName property: Group name.
     *
     * @param displayName the displayName value to set.
     * @return the GroupContractInner object itself.
     */
    public GroupContractInner withDisplayName(String displayName) {
        if (this.innerProperties() == null) {
            this.innerProperties = new GroupContractProperties();
        }
        this.innerProperties().withDisplayName(displayName);
        return this;
    }

    /**
     * Get the description property: Group description. Can contain HTML formatting tags.
     *
     * @return the description value.
     */
    public String description() {
        return this.innerProperties() == null ? null : this.innerProperties().description();
    }

    /**
     * Set the description property: Group description. Can contain HTML formatting tags.
     *
     * @param description the description value to set.
     * @return the GroupContractInner object itself.
     */
    public GroupContractInner withDescription(String description) {
        if (this.innerProperties() == null) {
            this.innerProperties = new GroupContractProperties();
        }
        this.innerProperties().withDescription(description);
        return this;
    }

    /**
     * Get the builtIn property: true if the group is one of the three system groups (Administrators, Developers, or
     * Guests); otherwise false.
     *
     * @return the builtIn value.
     */
    public Boolean builtIn() {
        return this.innerProperties() == null ? null : this.innerProperties().builtIn();
    }

    /**
     * Get the type property: Group type.
     *
     * @return the type value.
     */
    public GroupType typePropertiesType() {
        return this.innerProperties() == null ? null : this.innerProperties().type();
    }

    /**
     * Set the type property: Group type.
     *
     * @param type the type value to set.
     * @return the GroupContractInner object itself.
     */
    public GroupContractInner withTypePropertiesType(GroupType type) {
        if (this.innerProperties() == null) {
            this.innerProperties = new GroupContractProperties();
        }
        this.innerProperties().withType(type);
        return this;
    }

    /**
     * Get the externalId property: For external groups, this property contains the id of the group from the external
     * identity provider, e.g. for Azure Active Directory `aad://&lt;tenant&gt;.onmicrosoft.com/groups/&lt;group object
     * id&gt;`; otherwise the value is null.
     *
     * @return the externalId value.
     */
    public String externalId() {
        return this.innerProperties() == null ? null : this.innerProperties().externalId();
    }

    /**
     * Set the externalId property: For external groups, this property contains the id of the group from the external
     * identity provider, e.g. for Azure Active Directory `aad://&lt;tenant&gt;.onmicrosoft.com/groups/&lt;group object
     * id&gt;`; otherwise the value is null.
     *
     * @param externalId the externalId value to set.
     * @return the GroupContractInner object itself.
     */
    public GroupContractInner withExternalId(String externalId) {
        if (this.innerProperties() == null) {
            this.innerProperties = new GroupContractProperties();
        }
        this.innerProperties().withExternalId(externalId);
        return this;
    }

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