import { createAction as t } from "@reduxjs/toolkit"
import { CALL_NEXT_STATE_KEY as e } from "./call.constants"
import { CALL_NEXT_INITIAL_STATE as l } from "./call.state"
import { openCallReducer as o, closeCallReducer as a } from "./reducers/call-reducers"
export const openCall = t("call-next/open-call")
export const closeCall = t("call-next/close-call")
export const callNextReducer = (t = l, e) => {
switch (e.type) {
case openCall.type:
return o(t, e)
case closeCall.type:
return a()
default:
return t
}
}
export const getCallNextState = (t) => t[e]
export const getCallNextRoomId = (t) => getCallNextState(t).roomId
export const getCallNextIsCallOpen = (t) => getCallNextState(t).isCallOpen
export const getCallNextCallKey = (t) => getCallNextState(t).callKey
export const getCallNextCodecs = (t) => getCallNextState(t).codecs