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

package com.azure.resourcemanager.edgeorder.models;

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

/** Notification preference for a job stage. */
@Fluent
public final class NotificationPreference {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(NotificationPreference.class);

    /*
     * Name of the stage.
     */
    @JsonProperty(value = "stageName", required = true)
    private NotificationStageName stageName;

    /*
     * Notification is required or not.
     */
    @JsonProperty(value = "sendNotification", required = true)
    private boolean sendNotification;

    /**
     * Get the stageName property: Name of the stage.
     *
     * @return the stageName value.
     */
    public NotificationStageName stageName() {
        return this.stageName;
    }

    /**
     * Set the stageName property: Name of the stage.
     *
     * @param stageName the stageName value to set.
     * @return the NotificationPreference object itself.
     */
    public NotificationPreference withStageName(NotificationStageName stageName) {
        this.stageName = stageName;
        return this;
    }

    /**
     * Get the sendNotification property: Notification is required or not.
     *
     * @return the sendNotification value.
     */
    public boolean sendNotification() {
        return this.sendNotification;
    }

    /**
     * Set the sendNotification property: Notification is required or not.
     *
     * @param sendNotification the sendNotification value to set.
     * @return the NotificationPreference object itself.
     */
    public NotificationPreference withSendNotification(boolean sendNotification) {
        this.sendNotification = sendNotification;
        return this;
    }

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