module TD.Query.SetChatActiveStoriesList
  (SetChatActiveStoriesList(..)
  , defaultSetChatActiveStoriesList
  ) where

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

-- | Changes story list in which stories from the chat are shown. Returns 'TD.Data.Ok.Ok'
data SetChatActiveStoriesList
  = SetChatActiveStoriesList
    { SetChatActiveStoriesList -> Maybe Int
chat_id    :: Maybe Int                 -- ^ Identifier of the chat that posted stories
    , SetChatActiveStoriesList -> Maybe StoryList
story_list :: Maybe StoryList.StoryList -- ^ New list for active stories posted by the chat
    }
  deriving (SetChatActiveStoriesList -> SetChatActiveStoriesList -> Bool
(SetChatActiveStoriesList -> SetChatActiveStoriesList -> Bool)
-> (SetChatActiveStoriesList -> SetChatActiveStoriesList -> Bool)
-> Eq SetChatActiveStoriesList
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetChatActiveStoriesList -> SetChatActiveStoriesList -> Bool
== :: SetChatActiveStoriesList -> SetChatActiveStoriesList -> Bool
$c/= :: SetChatActiveStoriesList -> SetChatActiveStoriesList -> Bool
/= :: SetChatActiveStoriesList -> SetChatActiveStoriesList -> Bool
Eq, Int -> SetChatActiveStoriesList -> ShowS
[SetChatActiveStoriesList] -> ShowS
SetChatActiveStoriesList -> String
(Int -> SetChatActiveStoriesList -> ShowS)
-> (SetChatActiveStoriesList -> String)
-> ([SetChatActiveStoriesList] -> ShowS)
-> Show SetChatActiveStoriesList
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetChatActiveStoriesList -> ShowS
showsPrec :: Int -> SetChatActiveStoriesList -> ShowS
$cshow :: SetChatActiveStoriesList -> String
show :: SetChatActiveStoriesList -> String
$cshowList :: [SetChatActiveStoriesList] -> ShowS
showList :: [SetChatActiveStoriesList] -> ShowS
Show)

instance I.ShortShow SetChatActiveStoriesList where
  shortShow :: SetChatActiveStoriesList -> String
shortShow
    SetChatActiveStoriesList
      { chat_id :: SetChatActiveStoriesList -> Maybe Int
chat_id    = Maybe Int
chat_id_
      , story_list :: SetChatActiveStoriesList -> Maybe StoryList
story_list = Maybe StoryList
story_list_
      }
        = String
"SetChatActiveStoriesList"
          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_
          , String
"story_list" String -> Maybe StoryList -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe StoryList
story_list_
          ]

instance AT.ToJSON SetChatActiveStoriesList where
  toJSON :: SetChatActiveStoriesList -> Value
toJSON
    SetChatActiveStoriesList
      { chat_id :: SetChatActiveStoriesList -> Maybe Int
chat_id    = Maybe Int
chat_id_
      , story_list :: SetChatActiveStoriesList -> Maybe StoryList
story_list = Maybe StoryList
story_list_
      }
        = [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
"setChatActiveStoriesList"
          , 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_
          , Key
"story_list" Key -> Maybe StoryList -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe StoryList
story_list_
          ]

defaultSetChatActiveStoriesList :: SetChatActiveStoriesList
defaultSetChatActiveStoriesList :: SetChatActiveStoriesList
defaultSetChatActiveStoriesList =
  SetChatActiveStoriesList
    { chat_id :: Maybe Int
chat_id    = Maybe Int
forall a. Maybe a
Nothing
    , story_list :: Maybe StoryList
story_list = Maybe StoryList
forall a. Maybe a
Nothing
    }