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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.core.management.SystemData;
import com.azure.resourcemanager.eventgrid.models.IdentityInfo;
import com.azure.resourcemanager.eventgrid.models.ResourceProvisioningState;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;

/** EventGrid System Topic. */
@Fluent
public final class SystemTopicInner extends Resource {
    /*
     * Properties of the system topic.
     */
    @JsonProperty(value = "properties")
    private SystemTopicProperties innerProperties;

    /*
     * The system metadata relating to System Topic resource.
     */
    @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY)
    private SystemData systemData;

    /*
     * Identity information for the resource.
     */
    @JsonProperty(value = "identity")
    private IdentityInfo identity;

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

    /**
     * Get the innerProperties property: Properties of the system topic.
     *
     * @return the innerProperties value.
     */
    private SystemTopicProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the systemData property: The system metadata relating to System Topic resource.
     *
     * @return the systemData value.
     */
    public SystemData systemData() {
        return this.systemData;
    }

    /**
     * Get the identity property: Identity information for the resource.
     *
     * @return the identity value.
     */
    public IdentityInfo identity() {
        return this.identity;
    }

    /**
     * Set the identity property: Identity information for the resource.
     *
     * @param identity the identity value to set.
     * @return the SystemTopicInner object itself.
     */
    public SystemTopicInner withIdentity(IdentityInfo identity) {
        this.identity = identity;
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public SystemTopicInner withLocation(String location) {
        super.withLocation(location);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public SystemTopicInner withTags(Map<String, String> tags) {
        super.withTags(tags);
        return this;
    }

    /**
     * Get the provisioningState property: Provisioning state of the system topic.
     *
     * @return the provisioningState value.
     */
    public ResourceProvisioningState provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the source property: Source for the system topic.
     *
     * @return the source value.
     */
    public String source() {
        return this.innerProperties() == null ? null : this.innerProperties().source();
    }

    /**
     * Set the source property: Source for the system topic.
     *
     * @param source the source value to set.
     * @return the SystemTopicInner object itself.
     */
    public SystemTopicInner withSource(String source) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SystemTopicProperties();
        }
        this.innerProperties().withSource(source);
        return this;
    }

    /**
     * Get the topicType property: TopicType for the system topic.
     *
     * @return the topicType value.
     */
    public String topicType() {
        return this.innerProperties() == null ? null : this.innerProperties().topicType();
    }

    /**
     * Set the topicType property: TopicType for the system topic.
     *
     * @param topicType the topicType value to set.
     * @return the SystemTopicInner object itself.
     */
    public SystemTopicInner withTopicType(String topicType) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SystemTopicProperties();
        }
        this.innerProperties().withTopicType(topicType);
        return this;
    }

    /**
     * Get the metricResourceId property: Metric resource id for the system topic.
     *
     * @return the metricResourceId value.
     */
    public String metricResourceId() {
        return this.innerProperties() == null ? null : this.innerProperties().metricResourceId();
    }

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