module TD.Query.GetPremiumInfoSticker
  (GetPremiumInfoSticker(..)
  ) where

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

-- | Returns the sticker to be used as representation of the Telegram Premium subscription. Returns 'TD.Data.Sticker.Sticker'
data GetPremiumInfoSticker
  = GetPremiumInfoSticker
    { GetPremiumInfoSticker -> Maybe Int
month_count :: Maybe Int -- ^ Number of months the Telegram Premium subscription will be active
    }
  deriving (GetPremiumInfoSticker -> GetPremiumInfoSticker -> Bool
(GetPremiumInfoSticker -> GetPremiumInfoSticker -> Bool)
-> (GetPremiumInfoSticker -> GetPremiumInfoSticker -> Bool)
-> Eq GetPremiumInfoSticker
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetPremiumInfoSticker -> GetPremiumInfoSticker -> Bool
== :: GetPremiumInfoSticker -> GetPremiumInfoSticker -> Bool
$c/= :: GetPremiumInfoSticker -> GetPremiumInfoSticker -> Bool
/= :: GetPremiumInfoSticker -> GetPremiumInfoSticker -> Bool
Eq, Int -> GetPremiumInfoSticker -> ShowS
[GetPremiumInfoSticker] -> ShowS
GetPremiumInfoSticker -> String
(Int -> GetPremiumInfoSticker -> ShowS)
-> (GetPremiumInfoSticker -> String)
-> ([GetPremiumInfoSticker] -> ShowS)
-> Show GetPremiumInfoSticker
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetPremiumInfoSticker -> ShowS
showsPrec :: Int -> GetPremiumInfoSticker -> ShowS
$cshow :: GetPremiumInfoSticker -> String
show :: GetPremiumInfoSticker -> String
$cshowList :: [GetPremiumInfoSticker] -> ShowS
showList :: [GetPremiumInfoSticker] -> ShowS
Show)

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

instance AT.ToJSON GetPremiumInfoSticker where
  toJSON :: GetPremiumInfoSticker -> Value
toJSON
    GetPremiumInfoSticker
      { month_count :: GetPremiumInfoSticker -> Maybe Int
month_count = Maybe Int
month_count_
      }
        = [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
"getPremiumInfoSticker"
          , Key
"month_count" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
month_count_
          ]