// 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.management.SubResource;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/**
 * A transformation object, containing all information associated with the named transformation. All transformations are
 * contained under a streaming job.
 */
@Fluent
public final class TransformationInner extends SubResource {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(TransformationInner.class);

    /*
     * The properties that are associated with a transformation. Required on
     * PUT (CreateOrReplace) requests.
     */
    @JsonProperty(value = "properties")
    private TransformationProperties innerProperties;

    /*
     * Resource name
     */
    @JsonProperty(value = "name")
    private String name;

    /*
     * Resource type
     */
    @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY)
    private String type;

    /**
     * Get the innerProperties property: The properties that are associated with a transformation. Required on PUT
     * (CreateOrReplace) requests.
     *
     * @return the innerProperties value.
     */
    private TransformationProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the name property: Resource name.
     *
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Set the name property: Resource name.
     *
     * @param name the name value to set.
     * @return the TransformationInner object itself.
     */
    public TransformationInner withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * Get the type property: Resource type.
     *
     * @return the type value.
     */
    public String type() {
        return this.type;
    }

    /** {@inheritDoc} */
    @Override
    public TransformationInner withId(String id) {
        super.withId(id);
        return this;
    }

    /**
     * Get the streamingUnits property: Specifies the number of streaming units that the streaming job uses.
     *
     * @return the streamingUnits value.
     */
    public Integer streamingUnits() {
        return this.innerProperties() == null ? null : this.innerProperties().streamingUnits();
    }

    /**
     * Set the streamingUnits property: Specifies the number of streaming units that the streaming job uses.
     *
     * @param streamingUnits the streamingUnits value to set.
     * @return the TransformationInner object itself.
     */
    public TransformationInner withStreamingUnits(Integer streamingUnits) {
        if (this.innerProperties() == null) {
            this.innerProperties = new TransformationProperties();
        }
        this.innerProperties().withStreamingUnits(streamingUnits);
        return this;
    }

    /**
     * Get the validStreamingUnits property: Specifies the valid streaming units a streaming job can scale to.
     *
     * @return the validStreamingUnits value.
     */
    public List<Integer> validStreamingUnits() {
        return this.innerProperties() == null ? null : this.innerProperties().validStreamingUnits();
    }

    /**
     * Set the validStreamingUnits property: Specifies the valid streaming units a streaming job can scale to.
     *
     * @param validStreamingUnits the validStreamingUnits value to set.
     * @return the TransformationInner object itself.
     */
    public TransformationInner withValidStreamingUnits(List<Integer> validStreamingUnits) {
        if (this.innerProperties() == null) {
            this.innerProperties = new TransformationProperties();
        }
        this.innerProperties().withValidStreamingUnits(validStreamingUnits);
        return this;
    }

    /**
     * Get the query property: Specifies the query that will be run in the streaming job. You can learn more about the
     * Stream Analytics Query Language (SAQL) here: https://msdn.microsoft.com/library/azure/dn834998 . Required on PUT
     * (CreateOrReplace) requests.
     *
     * @return the query value.
     */
    public String query() {
        return this.innerProperties() == null ? null : this.innerProperties().query();
    }

    /**
     * Set the query property: Specifies the query that will be run in the streaming job. You can learn more about the
     * Stream Analytics Query Language (SAQL) here: https://msdn.microsoft.com/library/azure/dn834998 . Required on PUT
     * (CreateOrReplace) requests.
     *
     * @param query the query value to set.
     * @return the TransformationInner object itself.
     */
    public TransformationInner withQuery(String query) {
        if (this.innerProperties() == null) {
            this.innerProperties = new TransformationProperties();
        }
        this.innerProperties().withQuery(query);
        return this;
    }

    /**
     * Get the etag property: The current entity tag for the transformation. This is an opaque string. You can use it to
     * detect whether the resource has changed between requests. You can also use it in the If-Match or If-None-Match
     * headers for write operations for optimistic concurrency.
     *
     * @return the etag value.
     */
    public String etag() {
        return this.innerProperties() == null ? null : this.innerProperties().etag();
    }

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