parseSubscriptionNotification :: [FileFieldLabel] -> BSERValue -> Parser SubscriptionNotification
parseSubscriptionNotification fileFieldLabels v@(BSERObject o) = do
    case M.lookup "files" o of
        Just _ -> do
            f <- parseSubscriptionFiles fileFieldLabels v
            pure $ Subscription_Files f
        Nothing ->
            case M.lookup "state-enter" o of
                Just _ -> do
                    s <- parseSubscriptionStateEnter v
                    pure $ Subscription_StateEnter s
                Nothing ->
                    case M.lookup "state-leave" o of
                        Just _ -> do
                            s <- parseSubscriptionStateLeave v
                            pure $ Subscription_StateLeave s
                        Nothing ->
                            fail "Unrecognized subscription notification"
parseSubscriptionNotification :: [FileFieldLabel] -> BSERValue -> Parser SubscriptionNotification
parseSubscriptionNotification fileFieldLabels v@(BSERObject o) = do
    case M.lookup "files" o of
        Just _ -> do
            f <- parseSubscriptionFiles fileFieldLabels v
            pure $ Subscription_Files f
        Nothing ->
            case M.lookup "state-enter" o of
                Just _ -> do
                    s <- parseSubscriptionStateEnter v
                    pure $ Subscription_StateEnter s
                Nothing ->
                    case M.lookup "state-leave" o of
                        Just _ -> do
                            s <- parseSubscriptionStateLeave v
                            pure $ Subscription_StateLeave s
                        Nothing ->
                            fail "Unrecognized subscription notification"
parseSubscriptionNotification fileFieldLabels v@(BSERObject o) = do
    case M.lookup "files" o of
        Just _ -> do
            f <- parseSubscriptionFiles fileFieldLabels v
            pure $ Subscription_Files f
        Nothing ->
            case M.lookup "state-enter" o of
                Just _ -> do
                    s <- parseSubscriptionStateEnter v
                    pure $ Subscription_StateEnter s
                Nothing ->
                    case M.lookup "state-leave" o of
                        Just _ -> do
                            s <- parseSubscriptionStateLeave v
                            pure $ Subscription_StateLeave s
                        Nothing ->
                            fail "Unrecognized subscription notification"