// 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.ProxyResource;
import com.azure.core.management.SystemData;
import com.azure.resourcemanager.eventgrid.models.EventInputSchema;
import com.azure.resourcemanager.eventgrid.models.NamespaceTopicProvisioningState;
import com.azure.resourcemanager.eventgrid.models.PublisherType;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Namespace topic details. */
@Fluent
public final class NamespaceTopicInner extends ProxyResource {
    /*
     * Properties of the namespace topic.
     */
    @JsonProperty(value = "properties")
    private NamespaceTopicProperties innerProperties;

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

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

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

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

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

    /**
     * Get the publisherType property: Publisher type of the namespace topic.
     *
     * @return the publisherType value.
     */
    public PublisherType publisherType() {
        return this.innerProperties() == null ? null : this.innerProperties().publisherType();
    }

    /**
     * Set the publisherType property: Publisher type of the namespace topic.
     *
     * @param publisherType the publisherType value to set.
     * @return the NamespaceTopicInner object itself.
     */
    public NamespaceTopicInner withPublisherType(PublisherType publisherType) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NamespaceTopicProperties();
        }
        this.innerProperties().withPublisherType(publisherType);
        return this;
    }

    /**
     * Get the inputSchema property: This determines the format that is expected for incoming events published to the
     * topic.
     *
     * @return the inputSchema value.
     */
    public EventInputSchema inputSchema() {
        return this.innerProperties() == null ? null : this.innerProperties().inputSchema();
    }

    /**
     * Set the inputSchema property: This determines the format that is expected for incoming events published to the
     * topic.
     *
     * @param inputSchema the inputSchema value to set.
     * @return the NamespaceTopicInner object itself.
     */
    public NamespaceTopicInner withInputSchema(EventInputSchema inputSchema) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NamespaceTopicProperties();
        }
        this.innerProperties().withInputSchema(inputSchema);
        return this;
    }

    /**
     * Get the eventRetentionInDays property: Event retention for the namespace topic expressed in days. The property
     * default value is 1 day. Min event retention duration value is 1 day and max event retention duration value is 1
     * day.
     *
     * @return the eventRetentionInDays value.
     */
    public Integer eventRetentionInDays() {
        return this.innerProperties() == null ? null : this.innerProperties().eventRetentionInDays();
    }

    /**
     * Set the eventRetentionInDays property: Event retention for the namespace topic expressed in days. The property
     * default value is 1 day. Min event retention duration value is 1 day and max event retention duration value is 1
     * day.
     *
     * @param eventRetentionInDays the eventRetentionInDays value to set.
     * @return the NamespaceTopicInner object itself.
     */
    public NamespaceTopicInner withEventRetentionInDays(Integer eventRetentionInDays) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NamespaceTopicProperties();
        }
        this.innerProperties().withEventRetentionInDays(eventRetentionInDays);
        return this;
    }

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