// 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.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Information about the deadletter destination with resource identity. */
@Fluent
public final class DeadLetterWithResourceIdentity {
    /*
     * The identity to use when dead-lettering events.
     */
    @JsonProperty(value = "identity")
    private EventSubscriptionIdentity identity;

    /*
     * Information about the destination where events have to be delivered for the event subscription.
     * Uses the managed identity setup on the parent resource (namely, topic or domain) to acquire the authentication
     * tokens being used during delivery / dead-lettering.
     */
    @JsonProperty(value = "deadLetterDestination")
    private DeadLetterDestination deadLetterDestination;

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

    /**
     * Get the identity property: The identity to use when dead-lettering events.
     *
     * @return the identity value.
     */
    public EventSubscriptionIdentity identity() {
        return this.identity;
    }

    /**
     * Set the identity property: The identity to use when dead-lettering events.
     *
     * @param identity the identity value to set.
     * @return the DeadLetterWithResourceIdentity object itself.
     */
    public DeadLetterWithResourceIdentity withIdentity(EventSubscriptionIdentity identity) {
        this.identity = identity;
        return this;
    }

    /**
     * Get the deadLetterDestination property: Information about the destination where events have to be delivered for
     * the event subscription. Uses the managed identity setup on the parent resource (namely, topic or domain) to
     * acquire the authentication tokens being used during delivery / dead-lettering.
     *
     * @return the deadLetterDestination value.
     */
    public DeadLetterDestination deadLetterDestination() {
        return this.deadLetterDestination;
    }

    /**
     * Set the deadLetterDestination property: Information about the destination where events have to be delivered for
     * the event subscription. Uses the managed identity setup on the parent resource (namely, topic or domain) to
     * acquire the authentication tokens being used during delivery / dead-lettering.
     *
     * @param deadLetterDestination the deadLetterDestination value to set.
     * @return the DeadLetterWithResourceIdentity object itself.
     */
    public DeadLetterWithResourceIdentity withDeadLetterDestination(DeadLetterDestination deadLetterDestination) {
        this.deadLetterDestination = deadLetterDestination;
        return this;
    }

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