/* tslint:disable */
/* eslint-disable */
/**
 * Synapse REST API
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: v1
 *
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */
import { mapValues } from '../runtime';
import { ExtendedStatsAggregationFromJSON, ExtendedStatsAggregationToJSON, } from './ExtendedStatsAggregation';
import { TermsAggregationFromJSON, TermsAggregationToJSON, } from './TermsAggregation';
import { DateRangeAggregationFromJSON, DateRangeAggregationToJSON, } from './DateRangeAggregation';
import { MissingAggregationFromJSON, MissingAggregationToJSON, } from './MissingAggregation';
import { CardinalityAggregationFromJSON, CardinalityAggregationToJSON, } from './CardinalityAggregation';
import { MinAggregationFromJSON, MinAggregationToJSON, } from './MinAggregation';
import { MaxAggregationFromJSON, MaxAggregationToJSON, } from './MaxAggregation';
import { RangeAggregationFromJSON, RangeAggregationToJSON, } from './RangeAggregation';
import { AvgAggregationFromJSON, AvgAggregationToJSON, } from './AvgAggregation';
import { HistogramAggregationFromJSON, HistogramAggregationToJSON, } from './HistogramAggregation';
import { ValueCountAggregationFromJSON, ValueCountAggregationToJSON, } from './ValueCountAggregation';
import { SumAggregationFromJSON, SumAggregationToJSON, } from './SumAggregation';
import { FiltersAggregationFromJSON, FiltersAggregationToJSON, } from './FiltersAggregation';
import { StatsAggregationFromJSON, StatsAggregationToJSON, } from './StatsAggregation';
import { DateHistogramAggregationFromJSON, DateHistogramAggregationToJSON, } from './DateHistogramAggregation';
import { DslQueryFromJSON, DslQueryToJSON, } from './DslQuery';
/**
 * Check if a given object implements the Aggregation interface.
 */
export function instanceOfAggregation(value) {
    return true;
}
export function AggregationFromJSON(json) {
    return AggregationFromJSONTyped(json, false);
}
export function AggregationFromJSONTyped(json, ignoreDiscriminator) {
    if (json == null) {
        return json;
    }
    return {
        'terms': json['terms'] == null ? undefined : TermsAggregationFromJSON(json['terms']),
        'histogram': json['histogram'] == null ? undefined : HistogramAggregationFromJSON(json['histogram']),
        'date_histogram': json['date_histogram'] == null ? undefined : DateHistogramAggregationFromJSON(json['date_histogram']),
        'range': json['range'] == null ? undefined : RangeAggregationFromJSON(json['range']),
        'date_range': json['date_range'] == null ? undefined : DateRangeAggregationFromJSON(json['date_range']),
        'missing': json['missing'] == null ? undefined : MissingAggregationFromJSON(json['missing']),
        'min': json['min'] == null ? undefined : MinAggregationFromJSON(json['min']),
        'max': json['max'] == null ? undefined : MaxAggregationFromJSON(json['max']),
        'avg': json['avg'] == null ? undefined : AvgAggregationFromJSON(json['avg']),
        'sum': json['sum'] == null ? undefined : SumAggregationFromJSON(json['sum']),
        'stats': json['stats'] == null ? undefined : StatsAggregationFromJSON(json['stats']),
        'extended_stats': json['extended_stats'] == null ? undefined : ExtendedStatsAggregationFromJSON(json['extended_stats']),
        'value_count': json['value_count'] == null ? undefined : ValueCountAggregationFromJSON(json['value_count']),
        'cardinality': json['cardinality'] == null ? undefined : CardinalityAggregationFromJSON(json['cardinality']),
        'filter': json['filter'] == null ? undefined : DslQueryFromJSON(json['filter']),
        'filters': json['filters'] == null ? undefined : FiltersAggregationFromJSON(json['filters']),
        'aggregations': json['aggregations'] == null ? undefined : (mapValues(json['aggregations'], AggregationFromJSON)),
    };
}
export function AggregationToJSON(json) {
    return AggregationToJSONTyped(json, false);
}
export function AggregationToJSONTyped(value, ignoreDiscriminator = false) {
    if (value == null) {
        return value;
    }
    return {
        'terms': TermsAggregationToJSON(value['terms']),
        'histogram': HistogramAggregationToJSON(value['histogram']),
        'date_histogram': DateHistogramAggregationToJSON(value['date_histogram']),
        'range': RangeAggregationToJSON(value['range']),
        'date_range': DateRangeAggregationToJSON(value['date_range']),
        'missing': MissingAggregationToJSON(value['missing']),
        'min': MinAggregationToJSON(value['min']),
        'max': MaxAggregationToJSON(value['max']),
        'avg': AvgAggregationToJSON(value['avg']),
        'sum': SumAggregationToJSON(value['sum']),
        'stats': StatsAggregationToJSON(value['stats']),
        'extended_stats': ExtendedStatsAggregationToJSON(value['extended_stats']),
        'value_count': ValueCountAggregationToJSON(value['value_count']),
        'cardinality': CardinalityAggregationToJSON(value['cardinality']),
        'filter': DslQueryToJSON(value['filter']),
        'filters': FiltersAggregationToJSON(value['filters']),
        'aggregations': value['aggregations'] == null ? undefined : (mapValues(value['aggregations'], AggregationToJSON)),
    };
}
//# sourceMappingURL=Aggregation.js.map