import { RecordSetVisitor } from "../proxy/RecordSetVisitor";
import { WorkPackageVisitor } from "./WorkPackageVisitor";
/**
 *
 */
export class WorkPackagesRecordSetVisitor extends RecordSetVisitor {
    constructor(value) {
        super(value);
    }
    // --- State Management Helpers --- //
    static emptyRecordSetVisitor() {
        return new WorkPackagesRecordSetVisitor(super.emptyRecordSetVisitor().enclosedJsonObject());
    }
    // --- State Management --- //
    updateBriefcaseColumnUsingSelections(selectedWorkPackageIds) {
        const workPackages = this.enclosedJsonObject().records;
        if (workPackages) {
            for (const r of workPackages) {
                let inBriefcase = false;
                for (const selectedId of selectedWorkPackageIds) {
                    if (r.id === selectedId) {
                        inBriefcase = true;
                        break;
                    }
                }
                const briefcaseProperty = {
                    "name": "briefcase",
                    "annotations": [],
                    "type": "hxgn.api.dialog.Property",
                    "value": inBriefcase
                };
                r.properties.push(briefcaseProperty);
            }
        }
    }
    visitRecordAtId(id) {
        return super.visitRecordAtId(id);
    }
    *visitRecords() {
        let index = 0;
        while (index < this.enclosedJsonObject().records.length) {
            yield new WorkPackageVisitor(this.enclosedJsonObject().records[index++]);
        }
    }
}
