import { bool_response } from "./bool_response";
import { reservation } from "./reservation.js";

export class reservations_response extends bool_response {
    #collection;

    constructor(target) {
        super(target);

        if (!this.result) {
            return;
        }

        this.#collection = new Array();

        target["reservations"].forEach(count => {
            this.#collection.push(new reservation(count));            
        });
    }

    get collection() {
        if (!this.result) {
            throw new Error(this.cause)
        }

        return this.#collection;
    }
}