"use strict";var __extends=this&&this.__extends||function(){var r=function(t,n){r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,o){e.__proto__=o}||function(e,o){for(var a in o)if(Object.prototype.hasOwnProperty.call(o,a))e[a]=o[a]};return r(t,n)};return function(t,n){if(typeof n!=="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");r(t,n);function e(){this.constructor=t}t.prototype=n===null?Object.create(n):(e.prototype=n.prototype,new e)}}();Object.defineProperty(exports,"__esModule",{value:true});exports.QueryChain=void 0;var AbstractCommand_1=require("../AbstractCommand");var logic_1=require("./logic");var eq_1=require("./eq");var neq_1=require("./neq");var lt_1=require("./lt");var lte_1=require("./lte");var gt_1=require("./gt");var gte_1=require("./gte");var in_1=require("./in");var nin_1=require("./nin");var exists_1=require("./exists");var mod_1=require("./mod");var all_1=require("./all");var elemMatch_1=require("./elemMatch");var QueryChain=function(r){__extends(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}t.prototype.appendCommand=function(n){n=t.unchain(n);if(this.lastCmd instanceof logic_1.AndCommand){this.lastCmd.pushCommand(n)}else{this.lastCmd=new logic_1.AndCommand([this.lastCmd,n])}return this};t.prototype.and=function(n){return this.appendCommand(n)};t.prototype.or=function(n){n=t.unchain(n);if(this.lastCmd instanceof logic_1.OrCommand){this.lastCmd.pushCommand(n)}else{this.lastCmd=new logic_1.OrCommand([this.lastCmd,n])}return this};t.prototype.not=function(n){return this.appendCommand(n)};t.prototype.nor=function(n){return this.appendCommand(n)};t.prototype.eq=function(n){return this.appendCommand(new eq_1.EqCommand(n))};t.prototype.neq=function(n){return this.appendCommand(new neq_1.NeqCommand(n))};t.prototype.lt=function(n){return this.appendCommand(new lt_1.LtCommand(n))};t.prototype.lte=function(n){return this.appendCommand(new lte_1.LteCommand(n))};t.prototype.gt=function(n){return this.appendCommand(new gt_1.GtCommand(n))};t.prototype.gte=function(n){return this.appendCommand(new gte_1.GteCommand(n))};t.prototype.in=function(n){return this.appendCommand(new in_1.InCommand(n))};t.prototype.nin=function(n){return this.appendCommand(new nin_1.NinCommand(n))};t.prototype.exists=function(n){return this.appendCommand(new exists_1.ExistsCommand(n))};t.prototype.mod=function(n,e){return this.appendCommand(new mod_1.ModCommand(n,e))};t.prototype.all=function(n){return this.appendCommand(new all_1.AllCommand(n))};t.prototype.elemMatch=function(n){return this.appendCommand(new elemMatch_1.ElemMatchCommand(t.unchain(n)))};t.prototype.size=function(n){return this.appendCommand(n)};return t}(AbstractCommand_1.CommandChain);exports.QueryChain=QueryChain;