"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SearchResponse = void 0;
const ta_json_1 = require("ta-json");
const entity_resource_1 = require("../entity-resource");
const resource_1 = __importDefault(require("../resource"));
const aggregation_response_resource_1 = require("./aggregation-response-resource");
const facet_response_resource_1 = require("./facet-response-resource");
const field_filter_response_resource_1 = require("./field-filter-response-resource");
const full_text_response_resource_1 = require("./full-text-response-resource");
const grouped_view_response_resource_1 = require("./grouped-view-response-resource");
const sorting_response_resource_1 = require("./sorting-response-resource");
const visual_search_response_resource_1 = require("./visual-search-response-resource");
let SearchResponse = class SearchResponse extends resource_1.default {
    constructor() {
        // #region Properties
        super(...arguments);
        this.sortingOptions = [];
        this.fieldFilters = [];
        this.fullTextFilters = [];
        this.facets = [];
        this.items = [];
        // #endregion
    }
    //? ExtensionData
    // #endregion
    // #region Methods
    getEntityResources() {
        if (this.groupedView != null) {
            return this.groupedView.getEntityResources();
        }
        return this.items;
    }
    getFieldFiltersResources() {
        return this.fieldFilters;
    }
    getFullTextFilterResources() {
        return this.fullTextFilters;
    }
    getFacetResources() {
        return this.facets;
    }
};
exports.SearchResponse = SearchResponse;
__decorate([
    (0, ta_json_1.JsonProperty)("query"),
    __metadata("design:type", String)
], SearchResponse.prototype, "query", void 0);
__decorate([
    (0, ta_json_1.JsonProperty)("skip"),
    __metadata("design:type", Number)
], SearchResponse.prototype, "skip", void 0);
__decorate([
    (0, ta_json_1.JsonProperty)("take"),
    __metadata("design:type", Number)
], SearchResponse.prototype, "take", void 0);
__decorate([
    (0, ta_json_1.JsonProperty)("totalItemCount"),
    __metadata("design:type", Number)
], SearchResponse.prototype, "totalItemCount", void 0);
__decorate([
    (0, ta_json_1.JsonProperty)("returnedItemCount"),
    __metadata("design:type", Number)
], SearchResponse.prototype, "returnedItemCount", void 0);
__decorate([
    (0, ta_json_1.JsonProperty)("sorting"),
    __metadata("design:type", sorting_response_resource_1.SortingResponseResource)
], SearchResponse.prototype, "sorting", void 0);
__decorate([
    (0, ta_json_1.JsonProperty)("sortingOptions"),
    (0, ta_json_1.JsonElementType)(sorting_response_resource_1.SortingResponseResource),
    __metadata("design:type", Array)
], SearchResponse.prototype, "sortingOptions", void 0);
__decorate([
    (0, ta_json_1.JsonProperty)("filters"),
    (0, ta_json_1.JsonElementType)(field_filter_response_resource_1.FieldFilterResponseResource),
    __metadata("design:type", Array)
], SearchResponse.prototype, "fieldFilters", void 0);
__decorate([
    (0, ta_json_1.JsonProperty)("fulltext"),
    (0, ta_json_1.JsonElementType)(full_text_response_resource_1.FullTextResponseResource),
    __metadata("design:type", Array)
], SearchResponse.prototype, "fullTextFilters", void 0);
__decorate([
    (0, ta_json_1.JsonProperty)("facets"),
    (0, ta_json_1.JsonElementType)(facet_response_resource_1.FacetResponseResource),
    __metadata("design:type", Array)
], SearchResponse.prototype, "facets", void 0);
__decorate([
    (0, ta_json_1.JsonProperty)("clearFilters"),
    __metadata("design:type", String)
], SearchResponse.prototype, "clearFilters", void 0);
__decorate([
    (0, ta_json_1.JsonProperty)("items"),
    (0, ta_json_1.JsonElementType)(entity_resource_1.EntityResource),
    __metadata("design:type", Array)
], SearchResponse.prototype, "items", void 0);
__decorate([
    (0, ta_json_1.JsonProperty)("superfacet"),
    __metadata("design:type", Number)
], SearchResponse.prototype, "superFacet", void 0);
__decorate([
    (0, ta_json_1.JsonProperty)("aggregations"),
    (0, ta_json_1.JsonType)(aggregation_response_resource_1.AggregationResponseResource),
    __metadata("design:type", Object)
], SearchResponse.prototype, "aggregations", void 0);
__decorate([
    (0, ta_json_1.JsonProperty)("grouped_view"),
    (0, ta_json_1.JsonType)(grouped_view_response_resource_1.GroupedViewResponseResource),
    __metadata("design:type", Object)
], SearchResponse.prototype, "groupedView", void 0);
__decorate([
    (0, ta_json_1.JsonProperty)("visualSearch"),
    __metadata("design:type", visual_search_response_resource_1.VisualSearchResponseResource)
], SearchResponse.prototype, "visualSearch", void 0);
exports.SearchResponse = SearchResponse = __decorate([
    (0, ta_json_1.JsonObject)()
], SearchResponse);
//# sourceMappingURL=search-response.js.map