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

package com.azure.resourcemanager.securityinsights.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Represents Insight Query. */
@Fluent
public final class InsightQueryItemProperties extends EntityQueryItemProperties {
    /*
     * The insight display name.
     */
    @JsonProperty(value = "displayName")
    private String displayName;

    /*
     * The insight description.
     */
    @JsonProperty(value = "description")
    private String description;

    /*
     * The base query of the insight.
     */
    @JsonProperty(value = "baseQuery")
    private String baseQuery;

    /*
     * The insight table query.
     */
    @JsonProperty(value = "tableQuery")
    private InsightQueryItemPropertiesTableQuery tableQuery;

    /*
     * The insight chart query.
     */
    @JsonProperty(value = "chartQuery")
    private Object chartQuery;

    /*
     * The activity query definitions.
     */
    @JsonProperty(value = "additionalQuery")
    private InsightQueryItemPropertiesAdditionalQuery additionalQuery;

    /*
     * The insight chart query.
     */
    @JsonProperty(value = "defaultTimeRange")
    private InsightQueryItemPropertiesDefaultTimeRange defaultTimeRange;

    /*
     * The insight chart query.
     */
    @JsonProperty(value = "referenceTimeRange")
    private InsightQueryItemPropertiesReferenceTimeRange referenceTimeRange;

    /**
     * Get the displayName property: The insight display name.
     *
     * @return the displayName value.
     */
    public String displayName() {
        return this.displayName;
    }

    /**
     * Set the displayName property: The insight display name.
     *
     * @param displayName the displayName value to set.
     * @return the InsightQueryItemProperties object itself.
     */
    public InsightQueryItemProperties withDisplayName(String displayName) {
        this.displayName = displayName;
        return this;
    }

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

    /**
     * Set the description property: The insight description.
     *
     * @param description the description value to set.
     * @return the InsightQueryItemProperties object itself.
     */
    public InsightQueryItemProperties withDescription(String description) {
        this.description = description;
        return this;
    }

    /**
     * Get the baseQuery property: The base query of the insight.
     *
     * @return the baseQuery value.
     */
    public String baseQuery() {
        return this.baseQuery;
    }

    /**
     * Set the baseQuery property: The base query of the insight.
     *
     * @param baseQuery the baseQuery value to set.
     * @return the InsightQueryItemProperties object itself.
     */
    public InsightQueryItemProperties withBaseQuery(String baseQuery) {
        this.baseQuery = baseQuery;
        return this;
    }

    /**
     * Get the tableQuery property: The insight table query.
     *
     * @return the tableQuery value.
     */
    public InsightQueryItemPropertiesTableQuery tableQuery() {
        return this.tableQuery;
    }

    /**
     * Set the tableQuery property: The insight table query.
     *
     * @param tableQuery the tableQuery value to set.
     * @return the InsightQueryItemProperties object itself.
     */
    public InsightQueryItemProperties withTableQuery(InsightQueryItemPropertiesTableQuery tableQuery) {
        this.tableQuery = tableQuery;
        return this;
    }

    /**
     * Get the chartQuery property: The insight chart query.
     *
     * @return the chartQuery value.
     */
    public Object chartQuery() {
        return this.chartQuery;
    }

    /**
     * Set the chartQuery property: The insight chart query.
     *
     * @param chartQuery the chartQuery value to set.
     * @return the InsightQueryItemProperties object itself.
     */
    public InsightQueryItemProperties withChartQuery(Object chartQuery) {
        this.chartQuery = chartQuery;
        return this;
    }

    /**
     * Get the additionalQuery property: The activity query definitions.
     *
     * @return the additionalQuery value.
     */
    public InsightQueryItemPropertiesAdditionalQuery additionalQuery() {
        return this.additionalQuery;
    }

    /**
     * Set the additionalQuery property: The activity query definitions.
     *
     * @param additionalQuery the additionalQuery value to set.
     * @return the InsightQueryItemProperties object itself.
     */
    public InsightQueryItemProperties withAdditionalQuery(InsightQueryItemPropertiesAdditionalQuery additionalQuery) {
        this.additionalQuery = additionalQuery;
        return this;
    }

    /**
     * Get the defaultTimeRange property: The insight chart query.
     *
     * @return the defaultTimeRange value.
     */
    public InsightQueryItemPropertiesDefaultTimeRange defaultTimeRange() {
        return this.defaultTimeRange;
    }

    /**
     * Set the defaultTimeRange property: The insight chart query.
     *
     * @param defaultTimeRange the defaultTimeRange value to set.
     * @return the InsightQueryItemProperties object itself.
     */
    public InsightQueryItemProperties withDefaultTimeRange(
        InsightQueryItemPropertiesDefaultTimeRange defaultTimeRange) {
        this.defaultTimeRange = defaultTimeRange;
        return this;
    }

    /**
     * Get the referenceTimeRange property: The insight chart query.
     *
     * @return the referenceTimeRange value.
     */
    public InsightQueryItemPropertiesReferenceTimeRange referenceTimeRange() {
        return this.referenceTimeRange;
    }

    /**
     * Set the referenceTimeRange property: The insight chart query.
     *
     * @param referenceTimeRange the referenceTimeRange value to set.
     * @return the InsightQueryItemProperties object itself.
     */
    public InsightQueryItemProperties withReferenceTimeRange(
        InsightQueryItemPropertiesReferenceTimeRange referenceTimeRange) {
        this.referenceTimeRange = referenceTimeRange;
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public InsightQueryItemProperties withDataTypes(List<EntityQueryItemPropertiesDataTypesItem> dataTypes) {
        super.withDataTypes(dataTypes);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public InsightQueryItemProperties withInputEntityType(EntityType inputEntityType) {
        super.withInputEntityType(inputEntityType);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public InsightQueryItemProperties withRequiredInputFieldsSets(List<List<String>> requiredInputFieldsSets) {
        super.withRequiredInputFieldsSets(requiredInputFieldsSets);
        return this;
    }

    /** {@inheritDoc} */
    @Override
    public InsightQueryItemProperties withEntitiesFilter(Object entitiesFilter) {
        super.withEntitiesFilter(entitiesFilter);
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
        super.validate();
        if (tableQuery() != null) {
            tableQuery().validate();
        }
        if (additionalQuery() != null) {
            additionalQuery().validate();
        }
        if (defaultTimeRange() != null) {
            defaultTimeRange().validate();
        }
        if (referenceTimeRange() != null) {
            referenceTimeRange().validate();
        }
    }
}
