"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Filter_1 = __importDefault(require("./Filter"));
class BudgetFilter extends Filter_1.default {
    constructor(min, max) {
        super();
        this.getMin = () => {
            return this.min;
        };
        this.getMax = () => {
            return this.max;
        };
        this.getLabel = () => {
            return 'Budget';
        };
        this.check = (room) => {
            // Return early if the min price is higher than max
            if (room.getLowestPrice() > this.max) {
                return null;
            }
            const rates = [];
            room.getOriginalRates().forEach((rate) => {
                if (rate.getAveragePrice() <= this.max && rate.getAveragePrice() >= this.min) {
                    rates.push(rate);
                }
            });
            room.filteredRates = rates;
            return room;
        };
        this.min = min;
        this.max = max;
    }
}
exports.default = BudgetFilter;
//# sourceMappingURL=BudgetFilter.js.map