module TD.Query.RemoveGiftCollectionGifts
  (RemoveGiftCollectionGifts(..)
  , defaultRemoveGiftCollectionGifts
  ) where

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

-- | Removes gifts from a collection. If the collection is owned by a channel chat, then requires can_post_messages administrator right in the channel chat. Returns the changed collection. Returns 'TD.Data.GiftCollection.GiftCollection'
data RemoveGiftCollectionGifts
  = RemoveGiftCollectionGifts
    { RemoveGiftCollectionGifts -> Maybe MessageSender
owner_id          :: Maybe MessageSender.MessageSender -- ^ Identifier of the user or the channel chat that owns the collection
    , RemoveGiftCollectionGifts -> Maybe Int
collection_id     :: Maybe Int                         -- ^ Identifier of the gift collection
    , RemoveGiftCollectionGifts -> Maybe [Text]
received_gift_ids :: Maybe [T.Text]                    -- ^ Identifier of the gifts to remove from the collection
    }
  deriving (RemoveGiftCollectionGifts -> RemoveGiftCollectionGifts -> Bool
(RemoveGiftCollectionGifts -> RemoveGiftCollectionGifts -> Bool)
-> (RemoveGiftCollectionGifts -> RemoveGiftCollectionGifts -> Bool)
-> Eq RemoveGiftCollectionGifts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RemoveGiftCollectionGifts -> RemoveGiftCollectionGifts -> Bool
== :: RemoveGiftCollectionGifts -> RemoveGiftCollectionGifts -> Bool
$c/= :: RemoveGiftCollectionGifts -> RemoveGiftCollectionGifts -> Bool
/= :: RemoveGiftCollectionGifts -> RemoveGiftCollectionGifts -> Bool
Eq, Int -> RemoveGiftCollectionGifts -> ShowS
[RemoveGiftCollectionGifts] -> ShowS
RemoveGiftCollectionGifts -> String
(Int -> RemoveGiftCollectionGifts -> ShowS)
-> (RemoveGiftCollectionGifts -> String)
-> ([RemoveGiftCollectionGifts] -> ShowS)
-> Show RemoveGiftCollectionGifts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RemoveGiftCollectionGifts -> ShowS
showsPrec :: Int -> RemoveGiftCollectionGifts -> ShowS
$cshow :: RemoveGiftCollectionGifts -> String
show :: RemoveGiftCollectionGifts -> String
$cshowList :: [RemoveGiftCollectionGifts] -> ShowS
showList :: [RemoveGiftCollectionGifts] -> ShowS
Show)

instance I.ShortShow RemoveGiftCollectionGifts where
  shortShow :: RemoveGiftCollectionGifts -> String
shortShow
    RemoveGiftCollectionGifts
      { owner_id :: RemoveGiftCollectionGifts -> Maybe MessageSender
owner_id          = Maybe MessageSender
owner_id_
      , collection_id :: RemoveGiftCollectionGifts -> Maybe Int
collection_id     = Maybe Int
collection_id_
      , received_gift_ids :: RemoveGiftCollectionGifts -> Maybe [Text]
received_gift_ids = Maybe [Text]
received_gift_ids_
      }
        = String
"RemoveGiftCollectionGifts"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"owner_id"          String -> Maybe MessageSender -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe MessageSender
owner_id_
          , String
"collection_id"     String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
collection_id_
          , String
"received_gift_ids" String -> Maybe [Text] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [Text]
received_gift_ids_
          ]

instance AT.ToJSON RemoveGiftCollectionGifts where
  toJSON :: RemoveGiftCollectionGifts -> Value
toJSON
    RemoveGiftCollectionGifts
      { owner_id :: RemoveGiftCollectionGifts -> Maybe MessageSender
owner_id          = Maybe MessageSender
owner_id_
      , collection_id :: RemoveGiftCollectionGifts -> Maybe Int
collection_id     = Maybe Int
collection_id_
      , received_gift_ids :: RemoveGiftCollectionGifts -> Maybe [Text]
received_gift_ids = Maybe [Text]
received_gift_ids_
      }
        = [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
"removeGiftCollectionGifts"
          , Key
"owner_id"          Key -> Maybe MessageSender -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe MessageSender
owner_id_
          , Key
"collection_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
collection_id_
          , Key
"received_gift_ids" Key -> Maybe [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe [Text]
received_gift_ids_
          ]

defaultRemoveGiftCollectionGifts :: RemoveGiftCollectionGifts
defaultRemoveGiftCollectionGifts :: RemoveGiftCollectionGifts
defaultRemoveGiftCollectionGifts =
  RemoveGiftCollectionGifts
    { owner_id :: Maybe MessageSender
owner_id          = Maybe MessageSender
forall a. Maybe a
Nothing
    , collection_id :: Maybe Int
collection_id     = Maybe Int
forall a. Maybe a
Nothing
    , received_gift_ids :: Maybe [Text]
received_gift_ids = Maybe [Text]
forall a. Maybe a
Nothing
    }