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

package com.azure.resourcemanager.customerinsights.models;

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

/** The KPI alias. */
@Fluent
public final class KpiAlias {
    /*
     * KPI alias name.
     */
    @JsonProperty(value = "aliasName", required = true)
    private String aliasName;

    /*
     * The expression.
     */
    @JsonProperty(value = "expression", required = true)
    private String expression;

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

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

    /**
     * Set the aliasName property: KPI alias name.
     *
     * @param aliasName the aliasName value to set.
     * @return the KpiAlias object itself.
     */
    public KpiAlias withAliasName(String aliasName) {
        this.aliasName = aliasName;
        return this;
    }

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

    /**
     * Set the expression property: The expression.
     *
     * @param expression the expression value to set.
     * @return the KpiAlias object itself.
     */
    public KpiAlias withExpression(String expression) {
        this.expression = expression;
        return this;
    }

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

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