import Foundation

extension CallState {
    static func reducer(state: inout CallState, action: CallAction) {
        switch action {
        case .startCall(let type, let jid):
            state.callType = type
            state.callDirection = .outgoing
            state.callStatus = .prepare
            state.participant = jid

        case .receiveCall(let type, let jid):
            state.callType = type
            state.callDirection = .incoming
            state.callStatus = .prepare
            state.participant = jid

        case .sdpSessionUpdated(let session):
            state.session = session

        default:
            break
        }
    }
}
