parseSubscriptionStateLeave :: BSERValue -> Parser SubscriptionStateLeave
parseSubscriptionStateLeave (BSERObject o) = do
    clockId <- parseClockId o
    root <- o .: "root"
    subscription <- o .: "subscription"
    state <- o .: "state-leave"
    let metadata = case M.lookup "metadata" o of
            Nothing -> Nothing
            Just v -> Just v
    let abandoned = case M.lookup "abandoned" o of
            Just (BSERBool True) -> True
            _ -> False
    pure SubscriptionStateLeave
      { _SubscriptionStateLeave_Clock = clockId
      , _SubscriptionStateLeave_Root = root
      , _SubscriptionStateLeave_Subscription = SubscriptionName subscription
      , _SubscriptionStateLeave_State = StateName state
      , _SubscriptionStateLeave_Metadata = metadata
      , _SubscriptionStateLeave_Abandoned = abandoned
      }
parseSubscriptionStateLeave :: BSERValue -> Parser SubscriptionStateLeave
parseSubscriptionStateLeave (BSERObject o) = do
    clockId <- parseClockId o
    root <- o .: "root"
    subscription <- o .: "subscription"
    state <- o .: "state-leave"
    let metadata = case M.lookup "metadata" o of
            Nothing -> Nothing
            Just v -> Just v
    let abandoned = case M.lookup "abandoned" o of
            Just (BSERBool True) -> True
            _ -> False
    pure SubscriptionStateLeave
      { _SubscriptionStateLeave_Clock = clockId
      , _SubscriptionStateLeave_Root = root
      , _SubscriptionStateLeave_Subscription = SubscriptionName subscription
      , _SubscriptionStateLeave_State = StateName state
      , _SubscriptionStateLeave_Metadata = metadata
      , _SubscriptionStateLeave_Abandoned = abandoned
      }
parseSubscriptionStateLeave (BSERObject o) = do
    clockId <- parseClockId o
    root <- o .: "root"
    subscription <- o .: "subscription"
    state <- o .: "state-leave"
    let metadata = case M.lookup "metadata" o of
            Nothing -> Nothing
            Just v -> Just v
    let abandoned = case M.lookup "abandoned" o of
            Just (BSERBool True) -> True
            _ -> False
    pure SubscriptionStateLeave
      { _SubscriptionStateLeave_Clock = clockId
      , _SubscriptionStateLeave_Root = root
      , _SubscriptionStateLeave_Subscription = SubscriptionName subscription
      , _SubscriptionStateLeave_State = StateName state
      , _SubscriptionStateLeave_Metadata = metadata
      , _SubscriptionStateLeave_Abandoned = abandoned
      }