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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.devtestlabs.models.Event;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.Map;

/** A notification. */
@Fluent
public final class NotificationChannelInner extends Resource {
    /*
     * The properties of the resource.
     */
    @JsonProperty(value = "properties", required = true)
    private NotificationChannelProperties innerProperties = new NotificationChannelProperties();

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

    /**
     * Get the innerProperties property: The properties of the resource.
     *
     * @return the innerProperties value.
     */
    private NotificationChannelProperties innerProperties() {
        return this.innerProperties;
    }

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

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

    /**
     * Get the webhookUrl property: The webhook URL to send notifications to.
     *
     * @return the webhookUrl value.
     */
    public String webhookUrl() {
        return this.innerProperties() == null ? null : this.innerProperties().webhookUrl();
    }

    /**
     * Set the webhookUrl property: The webhook URL to send notifications to.
     *
     * @param webhookUrl the webhookUrl value to set.
     * @return the NotificationChannelInner object itself.
     */
    public NotificationChannelInner withWebhookUrl(String webhookUrl) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NotificationChannelProperties();
        }
        this.innerProperties().withWebhookUrl(webhookUrl);
        return this;
    }

    /**
     * Get the emailRecipient property: The email recipient to send notifications to (can be a list of semi-colon
     * separated email addresses).
     *
     * @return the emailRecipient value.
     */
    public String emailRecipient() {
        return this.innerProperties() == null ? null : this.innerProperties().emailRecipient();
    }

    /**
     * Set the emailRecipient property: The email recipient to send notifications to (can be a list of semi-colon
     * separated email addresses).
     *
     * @param emailRecipient the emailRecipient value to set.
     * @return the NotificationChannelInner object itself.
     */
    public NotificationChannelInner withEmailRecipient(String emailRecipient) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NotificationChannelProperties();
        }
        this.innerProperties().withEmailRecipient(emailRecipient);
        return this;
    }

    /**
     * Get the notificationLocale property: The locale to use when sending a notification (fallback for unsupported
     * languages is EN).
     *
     * @return the notificationLocale value.
     */
    public String notificationLocale() {
        return this.innerProperties() == null ? null : this.innerProperties().notificationLocale();
    }

    /**
     * Set the notificationLocale property: The locale to use when sending a notification (fallback for unsupported
     * languages is EN).
     *
     * @param notificationLocale the notificationLocale value to set.
     * @return the NotificationChannelInner object itself.
     */
    public NotificationChannelInner withNotificationLocale(String notificationLocale) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NotificationChannelProperties();
        }
        this.innerProperties().withNotificationLocale(notificationLocale);
        return this;
    }

    /**
     * Get the description property: Description of notification.
     *
     * @return the description value.
     */
    public String description() {
        return this.innerProperties() == null ? null : this.innerProperties().description();
    }

    /**
     * Set the description property: Description of notification.
     *
     * @param description the description value to set.
     * @return the NotificationChannelInner object itself.
     */
    public NotificationChannelInner withDescription(String description) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NotificationChannelProperties();
        }
        this.innerProperties().withDescription(description);
        return this;
    }

    /**
     * Get the events property: The list of event for which this notification is enabled.
     *
     * @return the events value.
     */
    public List<Event> events() {
        return this.innerProperties() == null ? null : this.innerProperties().events();
    }

    /**
     * Set the events property: The list of event for which this notification is enabled.
     *
     * @param events the events value to set.
     * @return the NotificationChannelInner object itself.
     */
    public NotificationChannelInner withEvents(List<Event> events) {
        if (this.innerProperties() == null) {
            this.innerProperties = new NotificationChannelProperties();
        }
        this.innerProperties().withEvents(events);
        return this;
    }

    /**
     * Get the createdDate property: The creation date of the notification channel.
     *
     * @return the createdDate value.
     */
    public OffsetDateTime createdDate() {
        return this.innerProperties() == null ? null : this.innerProperties().createdDate();
    }

    /**
     * Get the provisioningState property: The provisioning status of the resource.
     *
     * @return the provisioningState value.
     */
    public String provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the uniqueIdentifier property: The unique immutable identifier of a resource (Guid).
     *
     * @return the uniqueIdentifier value.
     */
    public String uniqueIdentifier() {
        return this.innerProperties() == null ? null : this.innerProperties().uniqueIdentifier();
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (innerProperties() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException(
                        "Missing required property innerProperties in model NotificationChannelInner"));
        } else {
            innerProperties().validate();
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(NotificationChannelInner.class);
}
