import BadDataException from "../Exception/BadDataException";
import { ObjectType } from "../JSON";
import QueryOperator from "./QueryOperator";
export default class MultiSearch extends QueryOperator {
    get fields() {
        return this._fields;
    }
    set fields(v) {
        this._fields = v;
    }
    get value() {
        return this._value;
    }
    set value(v) {
        this._value = v;
    }
    constructor(data) {
        super();
        this._fields = [];
        this._value = "";
        this.fields = data.fields;
        this.value = data.value;
    }
    toString() {
        return this.value;
    }
    toJSON() {
        return {
            _type: ObjectType.MultiSearch,
            value: this.value,
            fields: this.fields,
        };
    }
    static fromJSON(json) {
        if (json["_type"] === ObjectType.MultiSearch) {
            return new MultiSearch({
                fields: json["fields"] || [],
                value: json["value"] || "",
            });
        }
        throw new BadDataException("Invalid JSON: " + JSON.stringify(json));
    }
}
//# sourceMappingURL=MultiSearch.js.map