"use strict";
// automatically generated by the FlatBuffers compiler, do not modify
Object.defineProperty(exports, "__esModule", { value: true });
exports.Body = void 0;
exports.unionToBody = unionToBody;
exports.unionListToBody = unionListToBody;
/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */
const enable_trace_event_request_1 = require("../../fbs/consumer/enable-trace-event-request");
const set_preferred_layers_request_1 = require("../../fbs/consumer/set-preferred-layers-request");
const set_priority_request_1 = require("../../fbs/consumer/set-priority-request");
const add_subchannel_request_1 = require("../../fbs/data-consumer/add-subchannel-request");
const remove_subchannel_request_1 = require("../../fbs/data-consumer/remove-subchannel-request");
const send_request_1 = require("../../fbs/data-consumer/send-request");
const set_buffered_amount_low_threshold_request_1 = require("../../fbs/data-consumer/set-buffered-amount-low-threshold-request");
const set_subchannels_request_1 = require("../../fbs/data-consumer/set-subchannels-request");
const connect_request_1 = require("../../fbs/pipe-transport/connect-request");
const connect_request_2 = require("../../fbs/plain-transport/connect-request");
const enable_trace_event_request_2 = require("../../fbs/producer/enable-trace-event-request");
const close_rtp_observer_request_1 = require("../../fbs/router/close-rtp-observer-request");
const close_transport_request_1 = require("../../fbs/router/close-transport-request");
const create_active_speaker_observer_request_1 = require("../../fbs/router/create-active-speaker-observer-request");
const create_audio_level_observer_request_1 = require("../../fbs/router/create-audio-level-observer-request");
const create_direct_transport_request_1 = require("../../fbs/router/create-direct-transport-request");
const create_pipe_transport_request_1 = require("../../fbs/router/create-pipe-transport-request");
const create_plain_transport_request_1 = require("../../fbs/router/create-plain-transport-request");
const create_web_rtc_transport_request_1 = require("../../fbs/router/create-web-rtc-transport-request");
const add_producer_request_1 = require("../../fbs/rtp-observer/add-producer-request");
const remove_producer_request_1 = require("../../fbs/rtp-observer/remove-producer-request");
const close_consumer_request_1 = require("../../fbs/transport/close-consumer-request");
const close_data_consumer_request_1 = require("../../fbs/transport/close-data-consumer-request");
const close_data_producer_request_1 = require("../../fbs/transport/close-data-producer-request");
const close_producer_request_1 = require("../../fbs/transport/close-producer-request");
const consume_data_request_1 = require("../../fbs/transport/consume-data-request");
const consume_request_1 = require("../../fbs/transport/consume-request");
const enable_trace_event_request_3 = require("../../fbs/transport/enable-trace-event-request");
const produce_data_request_1 = require("../../fbs/transport/produce-data-request");
const produce_request_1 = require("../../fbs/transport/produce-request");
const set_max_incoming_bitrate_request_1 = require("../../fbs/transport/set-max-incoming-bitrate-request");
const set_max_outgoing_bitrate_request_1 = require("../../fbs/transport/set-max-outgoing-bitrate-request");
const set_min_outgoing_bitrate_request_1 = require("../../fbs/transport/set-min-outgoing-bitrate-request");
const connect_request_3 = require("../../fbs/web-rtc-transport/connect-request");
const close_router_request_1 = require("../../fbs/worker/close-router-request");
const close_web_rtc_server_request_1 = require("../../fbs/worker/close-web-rtc-server-request");
const create_router_request_1 = require("../../fbs/worker/create-router-request");
const create_web_rtc_server_request_1 = require("../../fbs/worker/create-web-rtc-server-request");
const update_settings_request_1 = require("../../fbs/worker/update-settings-request");
var Body;
(function (Body) {
    Body[Body["NONE"] = 0] = "NONE";
    Body[Body["Worker_UpdateSettingsRequest"] = 1] = "Worker_UpdateSettingsRequest";
    Body[Body["Worker_CreateWebRtcServerRequest"] = 2] = "Worker_CreateWebRtcServerRequest";
    Body[Body["Worker_CloseWebRtcServerRequest"] = 3] = "Worker_CloseWebRtcServerRequest";
    Body[Body["Worker_CreateRouterRequest"] = 4] = "Worker_CreateRouterRequest";
    Body[Body["Worker_CloseRouterRequest"] = 5] = "Worker_CloseRouterRequest";
    Body[Body["Router_CreateWebRtcTransportRequest"] = 6] = "Router_CreateWebRtcTransportRequest";
    Body[Body["Router_CreatePlainTransportRequest"] = 7] = "Router_CreatePlainTransportRequest";
    Body[Body["Router_CreatePipeTransportRequest"] = 8] = "Router_CreatePipeTransportRequest";
    Body[Body["Router_CreateDirectTransportRequest"] = 9] = "Router_CreateDirectTransportRequest";
    Body[Body["Router_CreateActiveSpeakerObserverRequest"] = 10] = "Router_CreateActiveSpeakerObserverRequest";
    Body[Body["Router_CreateAudioLevelObserverRequest"] = 11] = "Router_CreateAudioLevelObserverRequest";
    Body[Body["Router_CloseTransportRequest"] = 12] = "Router_CloseTransportRequest";
    Body[Body["Router_CloseRtpObserverRequest"] = 13] = "Router_CloseRtpObserverRequest";
    Body[Body["Transport_SetMaxIncomingBitrateRequest"] = 14] = "Transport_SetMaxIncomingBitrateRequest";
    Body[Body["Transport_SetMaxOutgoingBitrateRequest"] = 15] = "Transport_SetMaxOutgoingBitrateRequest";
    Body[Body["Transport_SetMinOutgoingBitrateRequest"] = 16] = "Transport_SetMinOutgoingBitrateRequest";
    Body[Body["Transport_ProduceRequest"] = 17] = "Transport_ProduceRequest";
    Body[Body["Transport_ConsumeRequest"] = 18] = "Transport_ConsumeRequest";
    Body[Body["Transport_ProduceDataRequest"] = 19] = "Transport_ProduceDataRequest";
    Body[Body["Transport_ConsumeDataRequest"] = 20] = "Transport_ConsumeDataRequest";
    Body[Body["Transport_EnableTraceEventRequest"] = 21] = "Transport_EnableTraceEventRequest";
    Body[Body["Transport_CloseProducerRequest"] = 22] = "Transport_CloseProducerRequest";
    Body[Body["Transport_CloseConsumerRequest"] = 23] = "Transport_CloseConsumerRequest";
    Body[Body["Transport_CloseDataProducerRequest"] = 24] = "Transport_CloseDataProducerRequest";
    Body[Body["Transport_CloseDataConsumerRequest"] = 25] = "Transport_CloseDataConsumerRequest";
    Body[Body["PlainTransport_ConnectRequest"] = 26] = "PlainTransport_ConnectRequest";
    Body[Body["PipeTransport_ConnectRequest"] = 27] = "PipeTransport_ConnectRequest";
    Body[Body["WebRtcTransport_ConnectRequest"] = 28] = "WebRtcTransport_ConnectRequest";
    Body[Body["Producer_EnableTraceEventRequest"] = 29] = "Producer_EnableTraceEventRequest";
    Body[Body["Consumer_SetPreferredLayersRequest"] = 30] = "Consumer_SetPreferredLayersRequest";
    Body[Body["Consumer_SetPriorityRequest"] = 31] = "Consumer_SetPriorityRequest";
    Body[Body["Consumer_EnableTraceEventRequest"] = 32] = "Consumer_EnableTraceEventRequest";
    Body[Body["DataConsumer_SetBufferedAmountLowThresholdRequest"] = 33] = "DataConsumer_SetBufferedAmountLowThresholdRequest";
    Body[Body["DataConsumer_SendRequest"] = 34] = "DataConsumer_SendRequest";
    Body[Body["DataConsumer_SetSubchannelsRequest"] = 35] = "DataConsumer_SetSubchannelsRequest";
    Body[Body["DataConsumer_AddSubchannelRequest"] = 36] = "DataConsumer_AddSubchannelRequest";
    Body[Body["DataConsumer_RemoveSubchannelRequest"] = 37] = "DataConsumer_RemoveSubchannelRequest";
    Body[Body["RtpObserver_AddProducerRequest"] = 38] = "RtpObserver_AddProducerRequest";
    Body[Body["RtpObserver_RemoveProducerRequest"] = 39] = "RtpObserver_RemoveProducerRequest";
})(Body || (exports.Body = Body = {}));
function unionToBody(type, accessor) {
    switch (Body[type]) {
        case 'NONE': return null;
        case 'Worker_UpdateSettingsRequest': return accessor(new update_settings_request_1.UpdateSettingsRequest());
        case 'Worker_CreateWebRtcServerRequest': return accessor(new create_web_rtc_server_request_1.CreateWebRtcServerRequest());
        case 'Worker_CloseWebRtcServerRequest': return accessor(new close_web_rtc_server_request_1.CloseWebRtcServerRequest());
        case 'Worker_CreateRouterRequest': return accessor(new create_router_request_1.CreateRouterRequest());
        case 'Worker_CloseRouterRequest': return accessor(new close_router_request_1.CloseRouterRequest());
        case 'Router_CreateWebRtcTransportRequest': return accessor(new create_web_rtc_transport_request_1.CreateWebRtcTransportRequest());
        case 'Router_CreatePlainTransportRequest': return accessor(new create_plain_transport_request_1.CreatePlainTransportRequest());
        case 'Router_CreatePipeTransportRequest': return accessor(new create_pipe_transport_request_1.CreatePipeTransportRequest());
        case 'Router_CreateDirectTransportRequest': return accessor(new create_direct_transport_request_1.CreateDirectTransportRequest());
        case 'Router_CreateActiveSpeakerObserverRequest': return accessor(new create_active_speaker_observer_request_1.CreateActiveSpeakerObserverRequest());
        case 'Router_CreateAudioLevelObserverRequest': return accessor(new create_audio_level_observer_request_1.CreateAudioLevelObserverRequest());
        case 'Router_CloseTransportRequest': return accessor(new close_transport_request_1.CloseTransportRequest());
        case 'Router_CloseRtpObserverRequest': return accessor(new close_rtp_observer_request_1.CloseRtpObserverRequest());
        case 'Transport_SetMaxIncomingBitrateRequest': return accessor(new set_max_incoming_bitrate_request_1.SetMaxIncomingBitrateRequest());
        case 'Transport_SetMaxOutgoingBitrateRequest': return accessor(new set_max_outgoing_bitrate_request_1.SetMaxOutgoingBitrateRequest());
        case 'Transport_SetMinOutgoingBitrateRequest': return accessor(new set_min_outgoing_bitrate_request_1.SetMinOutgoingBitrateRequest());
        case 'Transport_ProduceRequest': return accessor(new produce_request_1.ProduceRequest());
        case 'Transport_ConsumeRequest': return accessor(new consume_request_1.ConsumeRequest());
        case 'Transport_ProduceDataRequest': return accessor(new produce_data_request_1.ProduceDataRequest());
        case 'Transport_ConsumeDataRequest': return accessor(new consume_data_request_1.ConsumeDataRequest());
        case 'Transport_EnableTraceEventRequest': return accessor(new enable_trace_event_request_3.EnableTraceEventRequest());
        case 'Transport_CloseProducerRequest': return accessor(new close_producer_request_1.CloseProducerRequest());
        case 'Transport_CloseConsumerRequest': return accessor(new close_consumer_request_1.CloseConsumerRequest());
        case 'Transport_CloseDataProducerRequest': return accessor(new close_data_producer_request_1.CloseDataProducerRequest());
        case 'Transport_CloseDataConsumerRequest': return accessor(new close_data_consumer_request_1.CloseDataConsumerRequest());
        case 'PlainTransport_ConnectRequest': return accessor(new connect_request_2.ConnectRequest());
        case 'PipeTransport_ConnectRequest': return accessor(new connect_request_1.ConnectRequest());
        case 'WebRtcTransport_ConnectRequest': return accessor(new connect_request_3.ConnectRequest());
        case 'Producer_EnableTraceEventRequest': return accessor(new enable_trace_event_request_2.EnableTraceEventRequest());
        case 'Consumer_SetPreferredLayersRequest': return accessor(new set_preferred_layers_request_1.SetPreferredLayersRequest());
        case 'Consumer_SetPriorityRequest': return accessor(new set_priority_request_1.SetPriorityRequest());
        case 'Consumer_EnableTraceEventRequest': return accessor(new enable_trace_event_request_1.EnableTraceEventRequest());
        case 'DataConsumer_SetBufferedAmountLowThresholdRequest': return accessor(new set_buffered_amount_low_threshold_request_1.SetBufferedAmountLowThresholdRequest());
        case 'DataConsumer_SendRequest': return accessor(new send_request_1.SendRequest());
        case 'DataConsumer_SetSubchannelsRequest': return accessor(new set_subchannels_request_1.SetSubchannelsRequest());
        case 'DataConsumer_AddSubchannelRequest': return accessor(new add_subchannel_request_1.AddSubchannelRequest());
        case 'DataConsumer_RemoveSubchannelRequest': return accessor(new remove_subchannel_request_1.RemoveSubchannelRequest());
        case 'RtpObserver_AddProducerRequest': return accessor(new add_producer_request_1.AddProducerRequest());
        case 'RtpObserver_RemoveProducerRequest': return accessor(new remove_producer_request_1.RemoveProducerRequest());
        default: return null;
    }
}
function unionListToBody(type, accessor, index) {
    switch (Body[type]) {
        case 'NONE': return null;
        case 'Worker_UpdateSettingsRequest': return accessor(index, new update_settings_request_1.UpdateSettingsRequest());
        case 'Worker_CreateWebRtcServerRequest': return accessor(index, new create_web_rtc_server_request_1.CreateWebRtcServerRequest());
        case 'Worker_CloseWebRtcServerRequest': return accessor(index, new close_web_rtc_server_request_1.CloseWebRtcServerRequest());
        case 'Worker_CreateRouterRequest': return accessor(index, new create_router_request_1.CreateRouterRequest());
        case 'Worker_CloseRouterRequest': return accessor(index, new close_router_request_1.CloseRouterRequest());
        case 'Router_CreateWebRtcTransportRequest': return accessor(index, new create_web_rtc_transport_request_1.CreateWebRtcTransportRequest());
        case 'Router_CreatePlainTransportRequest': return accessor(index, new create_plain_transport_request_1.CreatePlainTransportRequest());
        case 'Router_CreatePipeTransportRequest': return accessor(index, new create_pipe_transport_request_1.CreatePipeTransportRequest());
        case 'Router_CreateDirectTransportRequest': return accessor(index, new create_direct_transport_request_1.CreateDirectTransportRequest());
        case 'Router_CreateActiveSpeakerObserverRequest': return accessor(index, new create_active_speaker_observer_request_1.CreateActiveSpeakerObserverRequest());
        case 'Router_CreateAudioLevelObserverRequest': return accessor(index, new create_audio_level_observer_request_1.CreateAudioLevelObserverRequest());
        case 'Router_CloseTransportRequest': return accessor(index, new close_transport_request_1.CloseTransportRequest());
        case 'Router_CloseRtpObserverRequest': return accessor(index, new close_rtp_observer_request_1.CloseRtpObserverRequest());
        case 'Transport_SetMaxIncomingBitrateRequest': return accessor(index, new set_max_incoming_bitrate_request_1.SetMaxIncomingBitrateRequest());
        case 'Transport_SetMaxOutgoingBitrateRequest': return accessor(index, new set_max_outgoing_bitrate_request_1.SetMaxOutgoingBitrateRequest());
        case 'Transport_SetMinOutgoingBitrateRequest': return accessor(index, new set_min_outgoing_bitrate_request_1.SetMinOutgoingBitrateRequest());
        case 'Transport_ProduceRequest': return accessor(index, new produce_request_1.ProduceRequest());
        case 'Transport_ConsumeRequest': return accessor(index, new consume_request_1.ConsumeRequest());
        case 'Transport_ProduceDataRequest': return accessor(index, new produce_data_request_1.ProduceDataRequest());
        case 'Transport_ConsumeDataRequest': return accessor(index, new consume_data_request_1.ConsumeDataRequest());
        case 'Transport_EnableTraceEventRequest': return accessor(index, new enable_trace_event_request_3.EnableTraceEventRequest());
        case 'Transport_CloseProducerRequest': return accessor(index, new close_producer_request_1.CloseProducerRequest());
        case 'Transport_CloseConsumerRequest': return accessor(index, new close_consumer_request_1.CloseConsumerRequest());
        case 'Transport_CloseDataProducerRequest': return accessor(index, new close_data_producer_request_1.CloseDataProducerRequest());
        case 'Transport_CloseDataConsumerRequest': return accessor(index, new close_data_consumer_request_1.CloseDataConsumerRequest());
        case 'PlainTransport_ConnectRequest': return accessor(index, new connect_request_2.ConnectRequest());
        case 'PipeTransport_ConnectRequest': return accessor(index, new connect_request_1.ConnectRequest());
        case 'WebRtcTransport_ConnectRequest': return accessor(index, new connect_request_3.ConnectRequest());
        case 'Producer_EnableTraceEventRequest': return accessor(index, new enable_trace_event_request_2.EnableTraceEventRequest());
        case 'Consumer_SetPreferredLayersRequest': return accessor(index, new set_preferred_layers_request_1.SetPreferredLayersRequest());
        case 'Consumer_SetPriorityRequest': return accessor(index, new set_priority_request_1.SetPriorityRequest());
        case 'Consumer_EnableTraceEventRequest': return accessor(index, new enable_trace_event_request_1.EnableTraceEventRequest());
        case 'DataConsumer_SetBufferedAmountLowThresholdRequest': return accessor(index, new set_buffered_amount_low_threshold_request_1.SetBufferedAmountLowThresholdRequest());
        case 'DataConsumer_SendRequest': return accessor(index, new send_request_1.SendRequest());
        case 'DataConsumer_SetSubchannelsRequest': return accessor(index, new set_subchannels_request_1.SetSubchannelsRequest());
        case 'DataConsumer_AddSubchannelRequest': return accessor(index, new add_subchannel_request_1.AddSubchannelRequest());
        case 'DataConsumer_RemoveSubchannelRequest': return accessor(index, new remove_subchannel_request_1.RemoveSubchannelRequest());
        case 'RtpObserver_AddProducerRequest': return accessor(index, new add_producer_request_1.AddProducerRequest());
        case 'RtpObserver_RemoveProducerRequest': return accessor(index, new remove_producer_request_1.RemoveProducerRequest());
        default: return null;
    }
}
