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

package com.azure.resourcemanager.videoanalyzer.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.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import java.util.List;

/** Base class for topology processor nodes. */
@JsonTypeInfo(
    use = JsonTypeInfo.Id.NAME,
    include = JsonTypeInfo.As.PROPERTY,
    property = "@type",
    defaultImpl = ProcessorNodeBase.class)
@JsonTypeName("#Microsoft.VideoAnalyzer.ProcessorNodeBase")
@JsonSubTypes({@JsonSubTypes.Type(name = "#Microsoft.VideoAnalyzer.EncoderProcessor", value = EncoderProcessor.class)})
@Fluent
public class ProcessorNodeBase extends NodeBase {
    /*
     * An array of upstream node references within the topology to be used as
     * inputs for this node.
     */
    @JsonProperty(value = "inputs", required = true)
    private List<NodeInput> inputs;

    /**
     * Get the inputs property: An array of upstream node references within the topology to be used as inputs for this
     * node.
     *
     * @return the inputs value.
     */
    public List<NodeInput> inputs() {
        return this.inputs;
    }

    /**
     * Set the inputs property: An array of upstream node references within the topology to be used as inputs for this
     * node.
     *
     * @param inputs the inputs value to set.
     * @return the ProcessorNodeBase object itself.
     */
    public ProcessorNodeBase withInputs(List<NodeInput> inputs) {
        this.inputs = inputs;
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public ProcessorNodeBase withName(String name) {
        super.withName(name);
        return this;
    }

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

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