module TD.Query.GetBotSimilarBotCount
  (GetBotSimilarBotCount(..)
  , defaultGetBotSimilarBotCount
  ) where

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

-- | Returns approximate number of bots similar to the given bot. Returns 'TD.Data.Count.Count'
data GetBotSimilarBotCount
  = GetBotSimilarBotCount
    { GetBotSimilarBotCount -> Maybe Int
bot_user_id  :: Maybe Int  -- ^ User identifier of the target bot
    , GetBotSimilarBotCount -> Maybe Bool
return_local :: Maybe Bool -- ^ Pass true to get the number of bots without sending network requests, or -1 if the number of bots is unknown locally
    }
  deriving (GetBotSimilarBotCount -> GetBotSimilarBotCount -> Bool
(GetBotSimilarBotCount -> GetBotSimilarBotCount -> Bool)
-> (GetBotSimilarBotCount -> GetBotSimilarBotCount -> Bool)
-> Eq GetBotSimilarBotCount
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetBotSimilarBotCount -> GetBotSimilarBotCount -> Bool
== :: GetBotSimilarBotCount -> GetBotSimilarBotCount -> Bool
$c/= :: GetBotSimilarBotCount -> GetBotSimilarBotCount -> Bool
/= :: GetBotSimilarBotCount -> GetBotSimilarBotCount -> Bool
Eq, Int -> GetBotSimilarBotCount -> ShowS
[GetBotSimilarBotCount] -> ShowS
GetBotSimilarBotCount -> String
(Int -> GetBotSimilarBotCount -> ShowS)
-> (GetBotSimilarBotCount -> String)
-> ([GetBotSimilarBotCount] -> ShowS)
-> Show GetBotSimilarBotCount
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetBotSimilarBotCount -> ShowS
showsPrec :: Int -> GetBotSimilarBotCount -> ShowS
$cshow :: GetBotSimilarBotCount -> String
show :: GetBotSimilarBotCount -> String
$cshowList :: [GetBotSimilarBotCount] -> ShowS
showList :: [GetBotSimilarBotCount] -> ShowS
Show)

instance I.ShortShow GetBotSimilarBotCount where
  shortShow :: GetBotSimilarBotCount -> String
shortShow
    GetBotSimilarBotCount
      { bot_user_id :: GetBotSimilarBotCount -> Maybe Int
bot_user_id  = Maybe Int
bot_user_id_
      , return_local :: GetBotSimilarBotCount -> Maybe Bool
return_local = Maybe Bool
return_local_
      }
        = String
"GetBotSimilarBotCount"
          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
"return_local" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
return_local_
          ]

instance AT.ToJSON GetBotSimilarBotCount where
  toJSON :: GetBotSimilarBotCount -> Value
toJSON
    GetBotSimilarBotCount
      { bot_user_id :: GetBotSimilarBotCount -> Maybe Int
bot_user_id  = Maybe Int
bot_user_id_
      , return_local :: GetBotSimilarBotCount -> Maybe Bool
return_local = Maybe Bool
return_local_
      }
        = [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
"getBotSimilarBotCount"
          , 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
"return_local" Key -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Bool
return_local_
          ]

defaultGetBotSimilarBotCount :: GetBotSimilarBotCount
defaultGetBotSimilarBotCount :: GetBotSimilarBotCount
defaultGetBotSimilarBotCount =
  GetBotSimilarBotCount
    { bot_user_id :: Maybe Int
bot_user_id  = Maybe Int
forall a. Maybe a
Nothing
    , return_local :: Maybe Bool
return_local = Maybe Bool
forall a. Maybe a
Nothing
    }