// 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.models;

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

/** Describes how input data is compressed. */
@Fluent
public final class Compression {
    @JsonIgnore private final ClientLogger logger = new ClientLogger(Compression.class);

    /*
     * Indicates the type of compression that the input uses. Required on PUT
     * (CreateOrReplace) requests.
     */
    @JsonProperty(value = "type", required = true)
    private CompressionType type;

    /**
     * Get the type property: Indicates the type of compression that the input uses. Required on PUT (CreateOrReplace)
     * requests.
     *
     * @return the type value.
     */
    public CompressionType type() {
        return this.type;
    }

    /**
     * Set the type property: Indicates the type of compression that the input uses. Required on PUT (CreateOrReplace)
     * requests.
     *
     * @param type the type value to set.
     * @return the Compression object itself.
     */
    public Compression withType(CompressionType type) {
        this.type = type;
        return this;
    }

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