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

package com.azure.resourcemanager.dataprotection.models;

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

/**
 * AdhocBasedTriggerContext
 *
 * <p>Adhoc trigger context.
 */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "objectType")
@JsonTypeName("AdhocBasedTriggerContext")
@Fluent
public final class AdhocBasedTriggerContext extends TriggerContext {
    /*
     * AdhocBasedTaggingCriteria
     *
     * Tagging Criteria containing retention tag for adhoc backup.
     */
    @JsonProperty(value = "taggingCriteria", required = true)
    private AdhocBasedTaggingCriteria taggingCriteria;

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

    /**
     * Get the taggingCriteria property: AdhocBasedTaggingCriteria
     *
     * <p>Tagging Criteria containing retention tag for adhoc backup.
     *
     * @return the taggingCriteria value.
     */
    public AdhocBasedTaggingCriteria taggingCriteria() {
        return this.taggingCriteria;
    }

    /**
     * Set the taggingCriteria property: AdhocBasedTaggingCriteria
     *
     * <p>Tagging Criteria containing retention tag for adhoc backup.
     *
     * @param taggingCriteria the taggingCriteria value to set.
     * @return the AdhocBasedTriggerContext object itself.
     */
    public AdhocBasedTriggerContext withTaggingCriteria(AdhocBasedTaggingCriteria taggingCriteria) {
        this.taggingCriteria = taggingCriteria;
        return this;
    }

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

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