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

package com.azure.resourcemanager.streamanalytics.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.streamanalytics.models.FunctionBinding;
import com.azure.resourcemanager.streamanalytics.models.FunctionInput;
import com.azure.resourcemanager.streamanalytics.models.FunctionOutput;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Describes the configuration of the scalar function. */
@Fluent
public final class ScalarFunctionConfiguration {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(ScalarFunctionConfiguration.class);

    /*
     * A list of inputs describing the parameters of the function.
     */
    @JsonProperty(value = "inputs")
    private List<FunctionInput> inputs;

    /*
     * The output of the function.
     */
    @JsonProperty(value = "output")
    private FunctionOutput output;

    /*
     * The physical binding of the function. For example, in the Azure Machine
     * Learning web service’s case, this describes the endpoint.
     */
    @JsonProperty(value = "binding")
    private FunctionBinding binding;

    /**
     * Get the inputs property: A list of inputs describing the parameters of the function.
     *
     * @return the inputs value.
     */
    public List<FunctionInput> inputs() {
        return this.inputs;
    }

    /**
     * Set the inputs property: A list of inputs describing the parameters of the function.
     *
     * @param inputs the inputs value to set.
     * @return the ScalarFunctionConfiguration object itself.
     */
    public ScalarFunctionConfiguration withInputs(List<FunctionInput> inputs) {
        this.inputs = inputs;
        return this;
    }

    /**
     * Get the output property: The output of the function.
     *
     * @return the output value.
     */
    public FunctionOutput output() {
        return this.output;
    }

    /**
     * Set the output property: The output of the function.
     *
     * @param output the output value to set.
     * @return the ScalarFunctionConfiguration object itself.
     */
    public ScalarFunctionConfiguration withOutput(FunctionOutput output) {
        this.output = output;
        return this;
    }

    /**
     * Get the binding property: The physical binding of the function. For example, in the Azure Machine Learning web
     * service’s case, this describes the endpoint.
     *
     * @return the binding value.
     */
    public FunctionBinding binding() {
        return this.binding;
    }

    /**
     * Set the binding property: The physical binding of the function. For example, in the Azure Machine Learning web
     * service’s case, this describes the endpoint.
     *
     * @param binding the binding value to set.
     * @return the ScalarFunctionConfiguration object itself.
     */
    public ScalarFunctionConfiguration withBinding(FunctionBinding binding) {
        this.binding = binding;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (inputs() != null) {
            inputs().forEach(e -> e.validate());
        }
        if (output() != null) {
            output().validate();
        }
        if (binding() != null) {
            binding().validate();
        }
    }
}
