module TD.Query.ReplaceLiveStoryRtmpUrl
  (ReplaceLiveStoryRtmpUrl(..)
  ) where

import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I

-- | Replaces the current RTMP URL for streaming to a live story; requires owner privileges for channel chats. Returns 'TD.Data.RtmpUrl.RtmpUrl'
data ReplaceLiveStoryRtmpUrl
  = ReplaceLiveStoryRtmpUrl
    { ReplaceLiveStoryRtmpUrl -> Maybe Int
chat_id :: Maybe Int -- ^ Chat identifier
    }
  deriving (ReplaceLiveStoryRtmpUrl -> ReplaceLiveStoryRtmpUrl -> Bool
(ReplaceLiveStoryRtmpUrl -> ReplaceLiveStoryRtmpUrl -> Bool)
-> (ReplaceLiveStoryRtmpUrl -> ReplaceLiveStoryRtmpUrl -> Bool)
-> Eq ReplaceLiveStoryRtmpUrl
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ReplaceLiveStoryRtmpUrl -> ReplaceLiveStoryRtmpUrl -> Bool
== :: ReplaceLiveStoryRtmpUrl -> ReplaceLiveStoryRtmpUrl -> Bool
$c/= :: ReplaceLiveStoryRtmpUrl -> ReplaceLiveStoryRtmpUrl -> Bool
/= :: ReplaceLiveStoryRtmpUrl -> ReplaceLiveStoryRtmpUrl -> Bool
Eq, Int -> ReplaceLiveStoryRtmpUrl -> ShowS
[ReplaceLiveStoryRtmpUrl] -> ShowS
ReplaceLiveStoryRtmpUrl -> String
(Int -> ReplaceLiveStoryRtmpUrl -> ShowS)
-> (ReplaceLiveStoryRtmpUrl -> String)
-> ([ReplaceLiveStoryRtmpUrl] -> ShowS)
-> Show ReplaceLiveStoryRtmpUrl
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ReplaceLiveStoryRtmpUrl -> ShowS
showsPrec :: Int -> ReplaceLiveStoryRtmpUrl -> ShowS
$cshow :: ReplaceLiveStoryRtmpUrl -> String
show :: ReplaceLiveStoryRtmpUrl -> String
$cshowList :: [ReplaceLiveStoryRtmpUrl] -> ShowS
showList :: [ReplaceLiveStoryRtmpUrl] -> ShowS
Show)

instance I.ShortShow ReplaceLiveStoryRtmpUrl where
  shortShow :: ReplaceLiveStoryRtmpUrl -> String
shortShow
    ReplaceLiveStoryRtmpUrl
      { chat_id :: ReplaceLiveStoryRtmpUrl -> Maybe Int
chat_id = Maybe Int
chat_id_
      }
        = String
"ReplaceLiveStoryRtmpUrl"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"chat_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
chat_id_
          ]

instance AT.ToJSON ReplaceLiveStoryRtmpUrl where
  toJSON :: ReplaceLiveStoryRtmpUrl -> Value
toJSON
    ReplaceLiveStoryRtmpUrl
      { chat_id :: ReplaceLiveStoryRtmpUrl -> Maybe Int
chat_id = Maybe Int
chat_id_
      }
        = [Pair] -> Value
A.object
          [ Key
"@type"   Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"replaceLiveStoryRtmpUrl"
          , Key
"chat_id" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
chat_id_
          ]