"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FlowsStream = void 0;
const state_stream_1 = require("../state-stream");
class FlowsStream extends state_stream_1.StateStream {
    constructor(lockedData) {
        super();
        this.lockedData = lockedData;
    }
    async get(id) {
        return (Object.entries(this.lockedData.flows)
            .map(([id, flow]) => ({ id, name: flow.name }))
            .find((flow) => flow.id === id) ?? null);
    }
    async update(id, data) {
        return data;
    }
    async delete(id) {
        return { id, name: id };
    }
    async create(_, data) {
        return data;
    }
    async getList() {
        /**
         * Get list should receive a groupId argument but that's irrelevant for this stream
         * since we only have one group of flows.
         */
        return Object.entries(this.lockedData.flows).map(([id, flow]) => ({ id, name: flow.name }));
    }
    getGroupId() {
        /**
         * We're making it static to default because we only have one group of flows
         */
        return 'default';
    }
}
exports.FlowsStream = FlowsStream;
