module TD.Query.GetPollOptionProperties
  (GetPollOptionProperties(..)
  , defaultGetPollOptionProperties
  ) where

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

-- | Returns properties of a poll option. This is an offline method. Returns 'TD.Data.PollOptionProperties.PollOptionProperties'
data GetPollOptionProperties
  = GetPollOptionProperties
    { GetPollOptionProperties -> Maybe Int
chat_id        :: Maybe Int    -- ^ Chat identifier
    , GetPollOptionProperties -> Maybe Int
message_id     :: Maybe Int    -- ^ Identifier of the message
    , GetPollOptionProperties -> Maybe Text
poll_option_id :: Maybe T.Text -- ^ Unique identifier of the answer option, which properties will be returned
    }
  deriving (GetPollOptionProperties -> GetPollOptionProperties -> Bool
(GetPollOptionProperties -> GetPollOptionProperties -> Bool)
-> (GetPollOptionProperties -> GetPollOptionProperties -> Bool)
-> Eq GetPollOptionProperties
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetPollOptionProperties -> GetPollOptionProperties -> Bool
== :: GetPollOptionProperties -> GetPollOptionProperties -> Bool
$c/= :: GetPollOptionProperties -> GetPollOptionProperties -> Bool
/= :: GetPollOptionProperties -> GetPollOptionProperties -> Bool
Eq, Int -> GetPollOptionProperties -> ShowS
[GetPollOptionProperties] -> ShowS
GetPollOptionProperties -> String
(Int -> GetPollOptionProperties -> ShowS)
-> (GetPollOptionProperties -> String)
-> ([GetPollOptionProperties] -> ShowS)
-> Show GetPollOptionProperties
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetPollOptionProperties -> ShowS
showsPrec :: Int -> GetPollOptionProperties -> ShowS
$cshow :: GetPollOptionProperties -> String
show :: GetPollOptionProperties -> String
$cshowList :: [GetPollOptionProperties] -> ShowS
showList :: [GetPollOptionProperties] -> ShowS
Show)

instance I.ShortShow GetPollOptionProperties where
  shortShow :: GetPollOptionProperties -> String
shortShow
    GetPollOptionProperties
      { chat_id :: GetPollOptionProperties -> Maybe Int
chat_id        = Maybe Int
chat_id_
      , message_id :: GetPollOptionProperties -> Maybe Int
message_id     = Maybe Int
message_id_
      , poll_option_id :: GetPollOptionProperties -> Maybe Text
poll_option_id = Maybe Text
poll_option_id_
      }
        = String
"GetPollOptionProperties"
          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
"message_id"     String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
message_id_
          , String
"poll_option_id" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
poll_option_id_
          ]

instance AT.ToJSON GetPollOptionProperties where
  toJSON :: GetPollOptionProperties -> Value
toJSON
    GetPollOptionProperties
      { chat_id :: GetPollOptionProperties -> Maybe Int
chat_id        = Maybe Int
chat_id_
      , message_id :: GetPollOptionProperties -> Maybe Int
message_id     = Maybe Int
message_id_
      , poll_option_id :: GetPollOptionProperties -> Maybe Text
poll_option_id = Maybe Text
poll_option_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
"getPollOptionProperties"
          , 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
"message_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
message_id_
          , Key
"poll_option_id" Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
poll_option_id_
          ]

defaultGetPollOptionProperties :: GetPollOptionProperties
defaultGetPollOptionProperties :: GetPollOptionProperties
defaultGetPollOptionProperties =
  GetPollOptionProperties
    { chat_id :: Maybe Int
chat_id        = Maybe Int
forall a. Maybe a
Nothing
    , message_id :: Maybe Int
message_id     = Maybe Int
forall a. Maybe a
Nothing
    , poll_option_id :: Maybe Text
poll_option_id = Maybe Text
forall a. Maybe a
Nothing
    }