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

package com.azure.resourcemanager.logic.models;

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

/** The set trigger state action definition. */
@Fluent
public final class SetTriggerStateActionDefinition {
    /*
     * The source.
     */
    @JsonProperty(value = "source", required = true)
    private WorkflowTriggerReference source;

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

    /**
     * Get the source property: The source.
     *
     * @return the source value.
     */
    public WorkflowTriggerReference source() {
        return this.source;
    }

    /**
     * Set the source property: The source.
     *
     * @param source the source value to set.
     * @return the SetTriggerStateActionDefinition object itself.
     */
    public SetTriggerStateActionDefinition withSource(WorkflowTriggerReference source) {
        this.source = source;
        return this;
    }

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

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