module TD.Query.OpenBotSimilarBot
  (OpenBotSimilarBot(..)
  , defaultOpenBotSimilarBot
  ) where

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

-- | Informs TDLib that a bot was opened from the list of similar bots. Returns 'TD.Data.Ok.Ok'
data OpenBotSimilarBot
  = OpenBotSimilarBot
    { OpenBotSimilarBot -> Maybe Int
bot_user_id        :: Maybe Int -- ^ Identifier of the original bot, which similar bots were requested
    , OpenBotSimilarBot -> Maybe Int
opened_bot_user_id :: Maybe Int -- ^ Identifier of the opened bot
    }
  deriving (OpenBotSimilarBot -> OpenBotSimilarBot -> Bool
(OpenBotSimilarBot -> OpenBotSimilarBot -> Bool)
-> (OpenBotSimilarBot -> OpenBotSimilarBot -> Bool)
-> Eq OpenBotSimilarBot
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: OpenBotSimilarBot -> OpenBotSimilarBot -> Bool
== :: OpenBotSimilarBot -> OpenBotSimilarBot -> Bool
$c/= :: OpenBotSimilarBot -> OpenBotSimilarBot -> Bool
/= :: OpenBotSimilarBot -> OpenBotSimilarBot -> Bool
Eq, Int -> OpenBotSimilarBot -> ShowS
[OpenBotSimilarBot] -> ShowS
OpenBotSimilarBot -> String
(Int -> OpenBotSimilarBot -> ShowS)
-> (OpenBotSimilarBot -> String)
-> ([OpenBotSimilarBot] -> ShowS)
-> Show OpenBotSimilarBot
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> OpenBotSimilarBot -> ShowS
showsPrec :: Int -> OpenBotSimilarBot -> ShowS
$cshow :: OpenBotSimilarBot -> String
show :: OpenBotSimilarBot -> String
$cshowList :: [OpenBotSimilarBot] -> ShowS
showList :: [OpenBotSimilarBot] -> ShowS
Show)

instance I.ShortShow OpenBotSimilarBot where
  shortShow :: OpenBotSimilarBot -> String
shortShow
    OpenBotSimilarBot
      { bot_user_id :: OpenBotSimilarBot -> Maybe Int
bot_user_id        = Maybe Int
bot_user_id_
      , opened_bot_user_id :: OpenBotSimilarBot -> Maybe Int
opened_bot_user_id = Maybe Int
opened_bot_user_id_
      }
        = String
"OpenBotSimilarBot"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"bot_user_id"        String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
bot_user_id_
          , String
"opened_bot_user_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
opened_bot_user_id_
          ]

instance AT.ToJSON OpenBotSimilarBot where
  toJSON :: OpenBotSimilarBot -> Value
toJSON
    OpenBotSimilarBot
      { bot_user_id :: OpenBotSimilarBot -> Maybe Int
bot_user_id        = Maybe Int
bot_user_id_
      , opened_bot_user_id :: OpenBotSimilarBot -> Maybe Int
opened_bot_user_id = Maybe Int
opened_bot_user_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
"openBotSimilarBot"
          , Key
"bot_user_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
bot_user_id_
          , Key
"opened_bot_user_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
opened_bot_user_id_
          ]

defaultOpenBotSimilarBot :: OpenBotSimilarBot
defaultOpenBotSimilarBot :: OpenBotSimilarBot
defaultOpenBotSimilarBot =
  OpenBotSimilarBot
    { bot_user_id :: Maybe Int
bot_user_id        = Maybe Int
forall a. Maybe a
Nothing
    , opened_bot_user_id :: Maybe Int
opened_bot_user_id = Maybe Int
forall a. Maybe a
Nothing
    }