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

package com.azure.resourcemanager.servicefabric.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Describes the notification target properties. */
@Fluent
public final class NotificationTarget {
    /*
     * The notification channel indicates the type of receivers subscribed to the notification, either user or
     * subscription.
     */
    @JsonProperty(value = "notificationChannel", required = true)
    private NotificationChannel notificationChannel;

    /*
     * List of targets that subscribe to the notification.
     */
    @JsonProperty(value = "receivers", required = true)
    private List<String> receivers;

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

    /**
     * Get the notificationChannel property: The notification channel indicates the type of receivers subscribed to the
     * notification, either user or subscription.
     *
     * @return the notificationChannel value.
     */
    public NotificationChannel notificationChannel() {
        return this.notificationChannel;
    }

    /**
     * Set the notificationChannel property: The notification channel indicates the type of receivers subscribed to the
     * notification, either user or subscription.
     *
     * @param notificationChannel the notificationChannel value to set.
     * @return the NotificationTarget object itself.
     */
    public NotificationTarget withNotificationChannel(NotificationChannel notificationChannel) {
        this.notificationChannel = notificationChannel;
        return this;
    }

    /**
     * Get the receivers property: List of targets that subscribe to the notification.
     *
     * @return the receivers value.
     */
    public List<String> receivers() {
        return this.receivers;
    }

    /**
     * Set the receivers property: List of targets that subscribe to the notification.
     *
     * @param receivers the receivers value to set.
     * @return the NotificationTarget object itself.
     */
    public NotificationTarget withReceivers(List<String> receivers) {
        this.receivers = receivers;
        return this;
    }

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

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