module TD.Query.TransferBusinessAccountStars
  (TransferBusinessAccountStars(..)
  , defaultTransferBusinessAccountStars
  ) 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

-- | Transfers Telegram Stars from the business account to the business bot; for bots only. Returns 'TD.Data.Ok.Ok'
data TransferBusinessAccountStars
  = TransferBusinessAccountStars
    { TransferBusinessAccountStars -> Maybe Text
business_connection_id :: Maybe T.Text -- ^ Unique identifier of business connection
    , TransferBusinessAccountStars -> Maybe Int
star_count             :: Maybe Int    -- ^ Number of Telegram Stars to transfer
    }
  deriving (TransferBusinessAccountStars
-> TransferBusinessAccountStars -> Bool
(TransferBusinessAccountStars
 -> TransferBusinessAccountStars -> Bool)
-> (TransferBusinessAccountStars
    -> TransferBusinessAccountStars -> Bool)
-> Eq TransferBusinessAccountStars
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TransferBusinessAccountStars
-> TransferBusinessAccountStars -> Bool
== :: TransferBusinessAccountStars
-> TransferBusinessAccountStars -> Bool
$c/= :: TransferBusinessAccountStars
-> TransferBusinessAccountStars -> Bool
/= :: TransferBusinessAccountStars
-> TransferBusinessAccountStars -> Bool
Eq, Int -> TransferBusinessAccountStars -> ShowS
[TransferBusinessAccountStars] -> ShowS
TransferBusinessAccountStars -> String
(Int -> TransferBusinessAccountStars -> ShowS)
-> (TransferBusinessAccountStars -> String)
-> ([TransferBusinessAccountStars] -> ShowS)
-> Show TransferBusinessAccountStars
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TransferBusinessAccountStars -> ShowS
showsPrec :: Int -> TransferBusinessAccountStars -> ShowS
$cshow :: TransferBusinessAccountStars -> String
show :: TransferBusinessAccountStars -> String
$cshowList :: [TransferBusinessAccountStars] -> ShowS
showList :: [TransferBusinessAccountStars] -> ShowS
Show)

instance I.ShortShow TransferBusinessAccountStars where
  shortShow :: TransferBusinessAccountStars -> String
shortShow
    TransferBusinessAccountStars
      { business_connection_id :: TransferBusinessAccountStars -> Maybe Text
business_connection_id = Maybe Text
business_connection_id_
      , star_count :: TransferBusinessAccountStars -> Maybe Int
star_count             = Maybe Int
star_count_
      }
        = String
"TransferBusinessAccountStars"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"business_connection_id" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
business_connection_id_
          , String
"star_count"             String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
star_count_
          ]

instance AT.ToJSON TransferBusinessAccountStars where
  toJSON :: TransferBusinessAccountStars -> Value
toJSON
    TransferBusinessAccountStars
      { business_connection_id :: TransferBusinessAccountStars -> Maybe Text
business_connection_id = Maybe Text
business_connection_id_
      , star_count :: TransferBusinessAccountStars -> Maybe Int
star_count             = Maybe Int
star_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
"transferBusinessAccountStars"
          , Key
"business_connection_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
business_connection_id_
          , Key
"star_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
star_count_
          ]

defaultTransferBusinessAccountStars :: TransferBusinessAccountStars
defaultTransferBusinessAccountStars :: TransferBusinessAccountStars
defaultTransferBusinessAccountStars =
  TransferBusinessAccountStars
    { business_connection_id :: Maybe Text
business_connection_id = Maybe Text
forall a. Maybe a
Nothing
    , star_count :: Maybe Int
star_count             = Maybe Int
forall a. Maybe a
Nothing
    }