module TD.Data.StarTransactionType
  (StarTransactionType(..)) 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.Sticker as Sticker
import qualified TD.Data.RevenueWithdrawalState as RevenueWithdrawalState
import qualified TD.Data.PaidMedia as PaidMedia
import qualified Data.Text as T
import qualified TD.Data.AffiliateInfo as AffiliateInfo
import qualified TD.Data.ProductInfo as ProductInfo
import qualified Data.ByteString as BS
import qualified TD.Data.Gift as Gift
import qualified TD.Data.UpgradedGift as UpgradedGift

-- | Describes type of transaction with Telegram Stars
data StarTransactionType
  = StarTransactionTypePremiumBotDeposit -- ^ The transaction is a deposit of Telegram Stars from the Premium bot; for regular users only
  | StarTransactionTypeAppStoreDeposit -- ^ The transaction is a deposit of Telegram Stars from App Store; for regular users only
  | StarTransactionTypeGooglePlayDeposit -- ^ The transaction is a deposit of Telegram Stars from Google Play; for regular users only
  | StarTransactionTypeFragmentDeposit -- ^ The transaction is a deposit of Telegram Stars from Fragment; for regular users and bots only
  | StarTransactionTypeUserDeposit -- ^ The transaction is a deposit of Telegram Stars by another user; for regular users only
    { StarTransactionType -> Maybe Int
user_id :: Maybe Int             -- ^ Identifier of the user that gifted Telegram Stars; 0 if the user was anonymous
    , StarTransactionType -> Maybe Sticker
sticker :: Maybe Sticker.Sticker -- ^ The sticker to be shown in the transaction information; may be null if unknown
    }
  | StarTransactionTypeGiveawayDeposit -- ^ The transaction is a deposit of Telegram Stars from a giveaway; for regular users only
    { StarTransactionType -> Maybe Int
chat_id             :: Maybe Int -- ^ Identifier of a supergroup or a channel chat that created the giveaway
    , StarTransactionType -> Maybe Int
giveaway_message_id :: Maybe Int -- ^ Identifier of the message with the giveaway; can be 0 or an identifier of a deleted message
    }
  | StarTransactionTypeFragmentWithdrawal -- ^ The transaction is a withdrawal of earned Telegram Stars to Fragment; for bots and channel chats only
    { StarTransactionType -> Maybe RevenueWithdrawalState
withdrawal_state :: Maybe RevenueWithdrawalState.RevenueWithdrawalState -- ^ State of the withdrawal; may be null for refunds from Fragment
    }
  | StarTransactionTypeTelegramAdsWithdrawal -- ^ The transaction is a withdrawal of earned Telegram Stars to Telegram Ad platform; for bots and channel chats only
  | StarTransactionTypeTelegramApiUsage -- ^ The transaction is a payment for Telegram API usage; for bots only
    { StarTransactionType -> Maybe Int
request_count :: Maybe Int -- ^ The number of billed requests
    }
  | StarTransactionTypeBotPaidMediaPurchase -- ^ The transaction is a purchase of paid media from a bot or a business account by the current user; for regular users only
    { user_id :: Maybe Int                   -- ^ Identifier of the bot or the business account user that sent the paid media
    , StarTransactionType -> Maybe [PaidMedia]
media   :: Maybe [PaidMedia.PaidMedia] -- ^ The bought media if the transaction wasn't refunded
    }
  | StarTransactionTypeBotPaidMediaSale -- ^ The transaction is a sale of paid media by the bot or a business account managed by the bot; for bots only
    { user_id   :: Maybe Int                         -- ^ Identifier of the user that bought the media
    , media     :: Maybe [PaidMedia.PaidMedia]       -- ^ The bought media
    , StarTransactionType -> Maybe Text
payload   :: Maybe T.Text                      -- ^ Bot-provided payload
    , StarTransactionType -> Maybe AffiliateInfo
affiliate :: Maybe AffiliateInfo.AffiliateInfo -- ^ Information about the affiliate which received commission from the transaction; may be null if none
    }
  | StarTransactionTypeChannelPaidMediaPurchase -- ^ The transaction is a purchase of paid media from a channel by the current user; for regular users only
    { chat_id    :: Maybe Int                   -- ^ Identifier of the channel chat that sent the paid media
    , StarTransactionType -> Maybe Int
message_id :: Maybe Int                   -- ^ Identifier of the corresponding message with paid media; can be 0 or an identifier of a deleted message
    , media      :: Maybe [PaidMedia.PaidMedia] -- ^ The bought media if the transaction wasn't refunded
    }
  | StarTransactionTypeChannelPaidMediaSale -- ^ The transaction is a sale of paid media by the channel chat; for channel chats only
    { user_id    :: Maybe Int                   -- ^ Identifier of the user that bought the media
    , message_id :: Maybe Int                   -- ^ Identifier of the corresponding message with paid media; can be 0 or an identifier of a deleted message
    , media      :: Maybe [PaidMedia.PaidMedia] -- ^ The bought media
    }
  | StarTransactionTypeBotInvoicePurchase -- ^ The transaction is a purchase of a product from a bot or a business account by the current user; for regular users only
    { user_id      :: Maybe Int                     -- ^ Identifier of the bot or the business account user that created the invoice
    , StarTransactionType -> Maybe ProductInfo
product_info :: Maybe ProductInfo.ProductInfo -- ^ Information about the bought product
    }
  | StarTransactionTypeBotInvoiceSale -- ^ The transaction is a sale of a product by the bot; for bots only
    { user_id         :: Maybe Int                         -- ^ Identifier of the user that bought the product
    , product_info    :: Maybe ProductInfo.ProductInfo     -- ^ Information about the bought product
    , StarTransactionType -> Maybe ByteString
invoice_payload :: Maybe BS.ByteString               -- ^ Invoice payload
    , affiliate       :: Maybe AffiliateInfo.AffiliateInfo -- ^ Information about the affiliate which received commission from the transaction; may be null if none
    }
  | StarTransactionTypeBotSubscriptionPurchase -- ^ The transaction is a purchase of a subscription from a bot or a business account by the current user; for regular users only
    { user_id             :: Maybe Int                     -- ^ Identifier of the bot or the business account user that created the subscription link
    , StarTransactionType -> Maybe Int
subscription_period :: Maybe Int                     -- ^ The number of seconds between consecutive Telegram Star debitings
    , product_info        :: Maybe ProductInfo.ProductInfo -- ^ Information about the bought subscription
    }
  | StarTransactionTypeBotSubscriptionSale -- ^ The transaction is a sale of a subscription by the bot; for bots only
    { user_id             :: Maybe Int                         -- ^ Identifier of the user that bought the subscription
    , subscription_period :: Maybe Int                         -- ^ The number of seconds between consecutive Telegram Star debitings
    , product_info        :: Maybe ProductInfo.ProductInfo     -- ^ Information about the bought subscription
    , invoice_payload     :: Maybe BS.ByteString               -- ^ Invoice payload
    , affiliate           :: Maybe AffiliateInfo.AffiliateInfo -- ^ Information about the affiliate which received commission from the transaction; may be null if none
    }
  | StarTransactionTypeChannelSubscriptionPurchase -- ^ The transaction is a purchase of a subscription to a channel chat by the current user; for regular users only
    { chat_id             :: Maybe Int -- ^ Identifier of the channel chat that created the subscription
    , subscription_period :: Maybe Int -- ^ The number of seconds between consecutive Telegram Star debitings
    }
  | StarTransactionTypeChannelSubscriptionSale -- ^ The transaction is a sale of a subscription by the channel chat; for channel chats only
    { user_id             :: Maybe Int -- ^ Identifier of the user that bought the subscription
    , subscription_period :: Maybe Int -- ^ The number of seconds between consecutive Telegram Star debitings
    }
  | StarTransactionTypeGiftPurchase -- ^ The transaction is a purchase of a regular gift to another user; for regular users and bots only
    { user_id :: Maybe Int       -- ^ Identifier of the user that received the gift
    , StarTransactionType -> Maybe Gift
gift    :: Maybe Gift.Gift -- ^ The gift
    }
  | StarTransactionTypeGiftTransfer -- ^ The transaction is a transfer of an upgraded gift to another user; for regular users only
    { user_id :: Maybe Int                       -- ^ Identifier of the user that received the gift
    , StarTransactionType -> Maybe UpgradedGift
_gift   :: Maybe UpgradedGift.UpgradedGift -- ^ The gift
    }
  | StarTransactionTypeGiftSale -- ^ The transaction is a sale of a gift received from another user or bot; for regular users only
    { user_id :: Maybe Int       -- ^ Identifier of the user that sent the gift
    , gift    :: Maybe Gift.Gift -- ^ The gift
    }
  | StarTransactionTypeGiftUpgrade -- ^ The transaction is an upgrade of a gift; for regular users only
    { _gift :: Maybe UpgradedGift.UpgradedGift -- ^ The upgraded gift
    }
  | StarTransactionTypeChannelPaidReactionSend -- ^ The transaction is a sending of a paid reaction to a message in a channel chat by the current user; for regular users only
    { chat_id    :: Maybe Int -- ^ Identifier of the channel chat
    , message_id :: Maybe Int -- ^ Identifier of the reacted message; can be 0 or an identifier of a deleted message
    }
  | StarTransactionTypeChannelPaidReactionReceive -- ^ The transaction is a receiving of a paid reaction to a message by the channel chat; for channel chats only
    { user_id    :: Maybe Int -- ^ Identifier of the user that added the paid reaction
    , message_id :: Maybe Int -- ^ Identifier of the reacted message; can be 0 or an identifier of a deleted message
    }
  | StarTransactionTypeAffiliateProgramCommission -- ^ The transaction is a receiving of a commission from an affiliate program; for regular users, bots and channel chats only
    { chat_id              :: Maybe Int -- ^ Identifier of the chat that created the affiliate program
    , StarTransactionType -> Maybe Int
commission_per_mille :: Maybe Int -- ^ The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by the program owner
    }
  | StarTransactionTypeUnsupported -- ^ The transaction is a transaction of an unsupported type
  deriving (StarTransactionType -> StarTransactionType -> Bool
(StarTransactionType -> StarTransactionType -> Bool)
-> (StarTransactionType -> StarTransactionType -> Bool)
-> Eq StarTransactionType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: StarTransactionType -> StarTransactionType -> Bool
== :: StarTransactionType -> StarTransactionType -> Bool
$c/= :: StarTransactionType -> StarTransactionType -> Bool
/= :: StarTransactionType -> StarTransactionType -> Bool
Eq, Int -> StarTransactionType -> ShowS
[StarTransactionType] -> ShowS
StarTransactionType -> String
(Int -> StarTransactionType -> ShowS)
-> (StarTransactionType -> String)
-> ([StarTransactionType] -> ShowS)
-> Show StarTransactionType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> StarTransactionType -> ShowS
showsPrec :: Int -> StarTransactionType -> ShowS
$cshow :: StarTransactionType -> String
show :: StarTransactionType -> String
$cshowList :: [StarTransactionType] -> ShowS
showList :: [StarTransactionType] -> ShowS
Show)

instance I.ShortShow StarTransactionType where
  shortShow :: StarTransactionType -> String
shortShow StarTransactionType
StarTransactionTypePremiumBotDeposit
      = String
"StarTransactionTypePremiumBotDeposit"
  shortShow StarTransactionType
StarTransactionTypeAppStoreDeposit
      = String
"StarTransactionTypeAppStoreDeposit"
  shortShow StarTransactionType
StarTransactionTypeGooglePlayDeposit
      = String
"StarTransactionTypeGooglePlayDeposit"
  shortShow StarTransactionType
StarTransactionTypeFragmentDeposit
      = String
"StarTransactionTypeFragmentDeposit"
  shortShow StarTransactionTypeUserDeposit
    { user_id :: StarTransactionType -> Maybe Int
user_id = Maybe Int
user_id_
    , sticker :: StarTransactionType -> Maybe Sticker
sticker = Maybe Sticker
sticker_
    }
      = String
"StarTransactionTypeUserDeposit"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"user_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
user_id_
        , String
"sticker" String -> Maybe Sticker -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Sticker
sticker_
        ]
  shortShow StarTransactionTypeGiveawayDeposit
    { chat_id :: StarTransactionType -> Maybe Int
chat_id             = Maybe Int
chat_id_
    , giveaway_message_id :: StarTransactionType -> Maybe Int
giveaway_message_id = Maybe Int
giveaway_message_id_
    }
      = String
"StarTransactionTypeGiveawayDeposit"
        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
"giveaway_message_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
giveaway_message_id_
        ]
  shortShow StarTransactionTypeFragmentWithdrawal
    { withdrawal_state :: StarTransactionType -> Maybe RevenueWithdrawalState
withdrawal_state = Maybe RevenueWithdrawalState
withdrawal_state_
    }
      = String
"StarTransactionTypeFragmentWithdrawal"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"withdrawal_state" String -> Maybe RevenueWithdrawalState -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe RevenueWithdrawalState
withdrawal_state_
        ]
  shortShow StarTransactionType
StarTransactionTypeTelegramAdsWithdrawal
      = String
"StarTransactionTypeTelegramAdsWithdrawal"
  shortShow StarTransactionTypeTelegramApiUsage
    { request_count :: StarTransactionType -> Maybe Int
request_count = Maybe Int
request_count_
    }
      = String
"StarTransactionTypeTelegramApiUsage"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"request_count" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
request_count_
        ]
  shortShow StarTransactionTypeBotPaidMediaPurchase
    { user_id :: StarTransactionType -> Maybe Int
user_id = Maybe Int
user_id_
    , media :: StarTransactionType -> Maybe [PaidMedia]
media   = Maybe [PaidMedia]
media_
    }
      = String
"StarTransactionTypeBotPaidMediaPurchase"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"user_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
user_id_
        , String
"media"   String -> Maybe [PaidMedia] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [PaidMedia]
media_
        ]
  shortShow StarTransactionTypeBotPaidMediaSale
    { user_id :: StarTransactionType -> Maybe Int
user_id   = Maybe Int
user_id_
    , media :: StarTransactionType -> Maybe [PaidMedia]
media     = Maybe [PaidMedia]
media_
    , payload :: StarTransactionType -> Maybe Text
payload   = Maybe Text
payload_
    , affiliate :: StarTransactionType -> Maybe AffiliateInfo
affiliate = Maybe AffiliateInfo
affiliate_
    }
      = String
"StarTransactionTypeBotPaidMediaSale"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"user_id"   String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
user_id_
        , String
"media"     String -> Maybe [PaidMedia] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [PaidMedia]
media_
        , String
"payload"   String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
payload_
        , String
"affiliate" String -> Maybe AffiliateInfo -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe AffiliateInfo
affiliate_
        ]
  shortShow StarTransactionTypeChannelPaidMediaPurchase
    { chat_id :: StarTransactionType -> Maybe Int
chat_id    = Maybe Int
chat_id_
    , message_id :: StarTransactionType -> Maybe Int
message_id = Maybe Int
message_id_
    , media :: StarTransactionType -> Maybe [PaidMedia]
media      = Maybe [PaidMedia]
media_
    }
      = String
"StarTransactionTypeChannelPaidMediaPurchase"
        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
"media"      String -> Maybe [PaidMedia] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [PaidMedia]
media_
        ]
  shortShow StarTransactionTypeChannelPaidMediaSale
    { user_id :: StarTransactionType -> Maybe Int
user_id    = Maybe Int
user_id_
    , message_id :: StarTransactionType -> Maybe Int
message_id = Maybe Int
message_id_
    , media :: StarTransactionType -> Maybe [PaidMedia]
media      = Maybe [PaidMedia]
media_
    }
      = String
"StarTransactionTypeChannelPaidMediaSale"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"user_id"    String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
user_id_
        , String
"message_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
message_id_
        , String
"media"      String -> Maybe [PaidMedia] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [PaidMedia]
media_
        ]
  shortShow StarTransactionTypeBotInvoicePurchase
    { user_id :: StarTransactionType -> Maybe Int
user_id      = Maybe Int
user_id_
    , product_info :: StarTransactionType -> Maybe ProductInfo
product_info = Maybe ProductInfo
product_info_
    }
      = String
"StarTransactionTypeBotInvoicePurchase"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"user_id"      String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
user_id_
        , String
"product_info" String -> Maybe ProductInfo -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ProductInfo
product_info_
        ]
  shortShow StarTransactionTypeBotInvoiceSale
    { user_id :: StarTransactionType -> Maybe Int
user_id         = Maybe Int
user_id_
    , product_info :: StarTransactionType -> Maybe ProductInfo
product_info    = Maybe ProductInfo
product_info_
    , invoice_payload :: StarTransactionType -> Maybe ByteString
invoice_payload = Maybe ByteString
invoice_payload_
    , affiliate :: StarTransactionType -> Maybe AffiliateInfo
affiliate       = Maybe AffiliateInfo
affiliate_
    }
      = String
"StarTransactionTypeBotInvoiceSale"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"user_id"         String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
user_id_
        , String
"product_info"    String -> Maybe ProductInfo -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ProductInfo
product_info_
        , String
"invoice_payload" String -> Maybe ByteString -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ByteString
invoice_payload_
        , String
"affiliate"       String -> Maybe AffiliateInfo -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe AffiliateInfo
affiliate_
        ]
  shortShow StarTransactionTypeBotSubscriptionPurchase
    { user_id :: StarTransactionType -> Maybe Int
user_id             = Maybe Int
user_id_
    , subscription_period :: StarTransactionType -> Maybe Int
subscription_period = Maybe Int
subscription_period_
    , product_info :: StarTransactionType -> Maybe ProductInfo
product_info        = Maybe ProductInfo
product_info_
    }
      = String
"StarTransactionTypeBotSubscriptionPurchase"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"user_id"             String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
user_id_
        , String
"subscription_period" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
subscription_period_
        , String
"product_info"        String -> Maybe ProductInfo -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ProductInfo
product_info_
        ]
  shortShow StarTransactionTypeBotSubscriptionSale
    { user_id :: StarTransactionType -> Maybe Int
user_id             = Maybe Int
user_id_
    , subscription_period :: StarTransactionType -> Maybe Int
subscription_period = Maybe Int
subscription_period_
    , product_info :: StarTransactionType -> Maybe ProductInfo
product_info        = Maybe ProductInfo
product_info_
    , invoice_payload :: StarTransactionType -> Maybe ByteString
invoice_payload     = Maybe ByteString
invoice_payload_
    , affiliate :: StarTransactionType -> Maybe AffiliateInfo
affiliate           = Maybe AffiliateInfo
affiliate_
    }
      = String
"StarTransactionTypeBotSubscriptionSale"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"user_id"             String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
user_id_
        , String
"subscription_period" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
subscription_period_
        , String
"product_info"        String -> Maybe ProductInfo -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ProductInfo
product_info_
        , String
"invoice_payload"     String -> Maybe ByteString -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ByteString
invoice_payload_
        , String
"affiliate"           String -> Maybe AffiliateInfo -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe AffiliateInfo
affiliate_
        ]
  shortShow StarTransactionTypeChannelSubscriptionPurchase
    { chat_id :: StarTransactionType -> Maybe Int
chat_id             = Maybe Int
chat_id_
    , subscription_period :: StarTransactionType -> Maybe Int
subscription_period = Maybe Int
subscription_period_
    }
      = String
"StarTransactionTypeChannelSubscriptionPurchase"
        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
"subscription_period" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
subscription_period_
        ]
  shortShow StarTransactionTypeChannelSubscriptionSale
    { user_id :: StarTransactionType -> Maybe Int
user_id             = Maybe Int
user_id_
    , subscription_period :: StarTransactionType -> Maybe Int
subscription_period = Maybe Int
subscription_period_
    }
      = String
"StarTransactionTypeChannelSubscriptionSale"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"user_id"             String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
user_id_
        , String
"subscription_period" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
subscription_period_
        ]
  shortShow StarTransactionTypeGiftPurchase
    { user_id :: StarTransactionType -> Maybe Int
user_id = Maybe Int
user_id_
    , gift :: StarTransactionType -> Maybe Gift
gift    = Maybe Gift
gift_
    }
      = String
"StarTransactionTypeGiftPurchase"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"user_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
user_id_
        , String
"gift"    String -> Maybe Gift -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Gift
gift_
        ]
  shortShow StarTransactionTypeGiftTransfer
    { user_id :: StarTransactionType -> Maybe Int
user_id = Maybe Int
user_id_
    , _gift :: StarTransactionType -> Maybe UpgradedGift
_gift   = Maybe UpgradedGift
_gift_
    }
      = String
"StarTransactionTypeGiftTransfer"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"user_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
user_id_
        , String
"_gift"   String -> Maybe UpgradedGift -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe UpgradedGift
_gift_
        ]
  shortShow StarTransactionTypeGiftSale
    { user_id :: StarTransactionType -> Maybe Int
user_id = Maybe Int
user_id_
    , gift :: StarTransactionType -> Maybe Gift
gift    = Maybe Gift
gift_
    }
      = String
"StarTransactionTypeGiftSale"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"user_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
user_id_
        , String
"gift"    String -> Maybe Gift -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Gift
gift_
        ]
  shortShow StarTransactionTypeGiftUpgrade
    { _gift :: StarTransactionType -> Maybe UpgradedGift
_gift = Maybe UpgradedGift
_gift_
    }
      = String
"StarTransactionTypeGiftUpgrade"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"_gift" String -> Maybe UpgradedGift -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe UpgradedGift
_gift_
        ]
  shortShow StarTransactionTypeChannelPaidReactionSend
    { chat_id :: StarTransactionType -> Maybe Int
chat_id    = Maybe Int
chat_id_
    , message_id :: StarTransactionType -> Maybe Int
message_id = Maybe Int
message_id_
    }
      = String
"StarTransactionTypeChannelPaidReactionSend"
        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_
        ]
  shortShow StarTransactionTypeChannelPaidReactionReceive
    { user_id :: StarTransactionType -> Maybe Int
user_id    = Maybe Int
user_id_
    , message_id :: StarTransactionType -> Maybe Int
message_id = Maybe Int
message_id_
    }
      = String
"StarTransactionTypeChannelPaidReactionReceive"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"user_id"    String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
user_id_
        , String
"message_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
message_id_
        ]
  shortShow StarTransactionTypeAffiliateProgramCommission
    { chat_id :: StarTransactionType -> Maybe Int
chat_id              = Maybe Int
chat_id_
    , commission_per_mille :: StarTransactionType -> Maybe Int
commission_per_mille = Maybe Int
commission_per_mille_
    }
      = String
"StarTransactionTypeAffiliateProgramCommission"
        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
"commission_per_mille" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
commission_per_mille_
        ]
  shortShow StarTransactionType
StarTransactionTypeUnsupported
      = String
"StarTransactionTypeUnsupported"

instance AT.FromJSON StarTransactionType where
  parseJSON :: Value -> Parser StarTransactionType
parseJSON v :: Value
v@(AT.Object Object
obj) = do
    String
t <- Object
obj Object -> Key -> Parser String
forall a. FromJSON a => Object -> Key -> Parser a
A..: Key
"@type" :: AT.Parser String

    case String
t of
      String
"starTransactionTypePremiumBotDeposit"           -> StarTransactionType -> Parser StarTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure StarTransactionType
StarTransactionTypePremiumBotDeposit
      String
"starTransactionTypeAppStoreDeposit"             -> StarTransactionType -> Parser StarTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure StarTransactionType
StarTransactionTypeAppStoreDeposit
      String
"starTransactionTypeGooglePlayDeposit"           -> StarTransactionType -> Parser StarTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure StarTransactionType
StarTransactionTypeGooglePlayDeposit
      String
"starTransactionTypeFragmentDeposit"             -> StarTransactionType -> Parser StarTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure StarTransactionType
StarTransactionTypeFragmentDeposit
      String
"starTransactionTypeUserDeposit"                 -> Value -> Parser StarTransactionType
parseStarTransactionTypeUserDeposit Value
v
      String
"starTransactionTypeGiveawayDeposit"             -> Value -> Parser StarTransactionType
parseStarTransactionTypeGiveawayDeposit Value
v
      String
"starTransactionTypeFragmentWithdrawal"          -> Value -> Parser StarTransactionType
parseStarTransactionTypeFragmentWithdrawal Value
v
      String
"starTransactionTypeTelegramAdsWithdrawal"       -> StarTransactionType -> Parser StarTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure StarTransactionType
StarTransactionTypeTelegramAdsWithdrawal
      String
"starTransactionTypeTelegramApiUsage"            -> Value -> Parser StarTransactionType
parseStarTransactionTypeTelegramApiUsage Value
v
      String
"starTransactionTypeBotPaidMediaPurchase"        -> Value -> Parser StarTransactionType
parseStarTransactionTypeBotPaidMediaPurchase Value
v
      String
"starTransactionTypeBotPaidMediaSale"            -> Value -> Parser StarTransactionType
parseStarTransactionTypeBotPaidMediaSale Value
v
      String
"starTransactionTypeChannelPaidMediaPurchase"    -> Value -> Parser StarTransactionType
parseStarTransactionTypeChannelPaidMediaPurchase Value
v
      String
"starTransactionTypeChannelPaidMediaSale"        -> Value -> Parser StarTransactionType
parseStarTransactionTypeChannelPaidMediaSale Value
v
      String
"starTransactionTypeBotInvoicePurchase"          -> Value -> Parser StarTransactionType
parseStarTransactionTypeBotInvoicePurchase Value
v
      String
"starTransactionTypeBotInvoiceSale"              -> Value -> Parser StarTransactionType
parseStarTransactionTypeBotInvoiceSale Value
v
      String
"starTransactionTypeBotSubscriptionPurchase"     -> Value -> Parser StarTransactionType
parseStarTransactionTypeBotSubscriptionPurchase Value
v
      String
"starTransactionTypeBotSubscriptionSale"         -> Value -> Parser StarTransactionType
parseStarTransactionTypeBotSubscriptionSale Value
v
      String
"starTransactionTypeChannelSubscriptionPurchase" -> Value -> Parser StarTransactionType
parseStarTransactionTypeChannelSubscriptionPurchase Value
v
      String
"starTransactionTypeChannelSubscriptionSale"     -> Value -> Parser StarTransactionType
parseStarTransactionTypeChannelSubscriptionSale Value
v
      String
"starTransactionTypeGiftPurchase"                -> Value -> Parser StarTransactionType
parseStarTransactionTypeGiftPurchase Value
v
      String
"starTransactionTypeGiftTransfer"                -> Value -> Parser StarTransactionType
parseStarTransactionTypeGiftTransfer Value
v
      String
"starTransactionTypeGiftSale"                    -> Value -> Parser StarTransactionType
parseStarTransactionTypeGiftSale Value
v
      String
"starTransactionTypeGiftUpgrade"                 -> Value -> Parser StarTransactionType
parseStarTransactionTypeGiftUpgrade Value
v
      String
"starTransactionTypeChannelPaidReactionSend"     -> Value -> Parser StarTransactionType
parseStarTransactionTypeChannelPaidReactionSend Value
v
      String
"starTransactionTypeChannelPaidReactionReceive"  -> Value -> Parser StarTransactionType
parseStarTransactionTypeChannelPaidReactionReceive Value
v
      String
"starTransactionTypeAffiliateProgramCommission"  -> Value -> Parser StarTransactionType
parseStarTransactionTypeAffiliateProgramCommission Value
v
      String
"starTransactionTypeUnsupported"                 -> StarTransactionType -> Parser StarTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure StarTransactionType
StarTransactionTypeUnsupported
      String
_                                                -> Parser StarTransactionType
forall a. Monoid a => a
mempty
    
    where
      parseStarTransactionTypeUserDeposit :: A.Value -> AT.Parser StarTransactionType
      parseStarTransactionTypeUserDeposit :: Value -> Parser StarTransactionType
parseStarTransactionTypeUserDeposit = String
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"StarTransactionTypeUserDeposit" ((Object -> Parser StarTransactionType)
 -> Value -> Parser StarTransactionType)
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Int
user_id_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"user_id"
        Maybe Sticker
sticker_ <- Object
o Object -> Key -> Parser (Maybe Sticker)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"sticker"
        StarTransactionType -> Parser StarTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (StarTransactionType -> Parser StarTransactionType)
-> StarTransactionType -> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ StarTransactionTypeUserDeposit
          { user_id :: Maybe Int
user_id = Maybe Int
user_id_
          , sticker :: Maybe Sticker
sticker = Maybe Sticker
sticker_
          }
      parseStarTransactionTypeGiveawayDeposit :: A.Value -> AT.Parser StarTransactionType
      parseStarTransactionTypeGiveawayDeposit :: Value -> Parser StarTransactionType
parseStarTransactionTypeGiveawayDeposit = String
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"StarTransactionTypeGiveawayDeposit" ((Object -> Parser StarTransactionType)
 -> Value -> Parser StarTransactionType)
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Int
chat_id_             <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"chat_id"
        Maybe Int
giveaway_message_id_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"giveaway_message_id"
        StarTransactionType -> Parser StarTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (StarTransactionType -> Parser StarTransactionType)
-> StarTransactionType -> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ StarTransactionTypeGiveawayDeposit
          { chat_id :: Maybe Int
chat_id             = Maybe Int
chat_id_
          , giveaway_message_id :: Maybe Int
giveaway_message_id = Maybe Int
giveaway_message_id_
          }
      parseStarTransactionTypeFragmentWithdrawal :: A.Value -> AT.Parser StarTransactionType
      parseStarTransactionTypeFragmentWithdrawal :: Value -> Parser StarTransactionType
parseStarTransactionTypeFragmentWithdrawal = String
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"StarTransactionTypeFragmentWithdrawal" ((Object -> Parser StarTransactionType)
 -> Value -> Parser StarTransactionType)
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe RevenueWithdrawalState
withdrawal_state_ <- Object
o Object -> Key -> Parser (Maybe RevenueWithdrawalState)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"withdrawal_state"
        StarTransactionType -> Parser StarTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (StarTransactionType -> Parser StarTransactionType)
-> StarTransactionType -> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ StarTransactionTypeFragmentWithdrawal
          { withdrawal_state :: Maybe RevenueWithdrawalState
withdrawal_state = Maybe RevenueWithdrawalState
withdrawal_state_
          }
      parseStarTransactionTypeTelegramApiUsage :: A.Value -> AT.Parser StarTransactionType
      parseStarTransactionTypeTelegramApiUsage :: Value -> Parser StarTransactionType
parseStarTransactionTypeTelegramApiUsage = String
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"StarTransactionTypeTelegramApiUsage" ((Object -> Parser StarTransactionType)
 -> Value -> Parser StarTransactionType)
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Int
request_count_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"request_count"
        StarTransactionType -> Parser StarTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (StarTransactionType -> Parser StarTransactionType)
-> StarTransactionType -> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ StarTransactionTypeTelegramApiUsage
          { request_count :: Maybe Int
request_count = Maybe Int
request_count_
          }
      parseStarTransactionTypeBotPaidMediaPurchase :: A.Value -> AT.Parser StarTransactionType
      parseStarTransactionTypeBotPaidMediaPurchase :: Value -> Parser StarTransactionType
parseStarTransactionTypeBotPaidMediaPurchase = String
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"StarTransactionTypeBotPaidMediaPurchase" ((Object -> Parser StarTransactionType)
 -> Value -> Parser StarTransactionType)
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Int
user_id_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"user_id"
        Maybe [PaidMedia]
media_   <- Object
o Object -> Key -> Parser (Maybe [PaidMedia])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"media"
        StarTransactionType -> Parser StarTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (StarTransactionType -> Parser StarTransactionType)
-> StarTransactionType -> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ StarTransactionTypeBotPaidMediaPurchase
          { user_id :: Maybe Int
user_id = Maybe Int
user_id_
          , media :: Maybe [PaidMedia]
media   = Maybe [PaidMedia]
media_
          }
      parseStarTransactionTypeBotPaidMediaSale :: A.Value -> AT.Parser StarTransactionType
      parseStarTransactionTypeBotPaidMediaSale :: Value -> Parser StarTransactionType
parseStarTransactionTypeBotPaidMediaSale = String
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"StarTransactionTypeBotPaidMediaSale" ((Object -> Parser StarTransactionType)
 -> Value -> Parser StarTransactionType)
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Int
user_id_   <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"user_id"
        Maybe [PaidMedia]
media_     <- Object
o Object -> Key -> Parser (Maybe [PaidMedia])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"media"
        Maybe Text
payload_   <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"payload"
        Maybe AffiliateInfo
affiliate_ <- Object
o Object -> Key -> Parser (Maybe AffiliateInfo)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"affiliate"
        StarTransactionType -> Parser StarTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (StarTransactionType -> Parser StarTransactionType)
-> StarTransactionType -> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ StarTransactionTypeBotPaidMediaSale
          { user_id :: Maybe Int
user_id   = Maybe Int
user_id_
          , media :: Maybe [PaidMedia]
media     = Maybe [PaidMedia]
media_
          , payload :: Maybe Text
payload   = Maybe Text
payload_
          , affiliate :: Maybe AffiliateInfo
affiliate = Maybe AffiliateInfo
affiliate_
          }
      parseStarTransactionTypeChannelPaidMediaPurchase :: A.Value -> AT.Parser StarTransactionType
      parseStarTransactionTypeChannelPaidMediaPurchase :: Value -> Parser StarTransactionType
parseStarTransactionTypeChannelPaidMediaPurchase = String
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"StarTransactionTypeChannelPaidMediaPurchase" ((Object -> Parser StarTransactionType)
 -> Value -> Parser StarTransactionType)
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Int
chat_id_    <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"chat_id"
        Maybe Int
message_id_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"message_id"
        Maybe [PaidMedia]
media_      <- Object
o Object -> Key -> Parser (Maybe [PaidMedia])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"media"
        StarTransactionType -> Parser StarTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (StarTransactionType -> Parser StarTransactionType)
-> StarTransactionType -> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ StarTransactionTypeChannelPaidMediaPurchase
          { chat_id :: Maybe Int
chat_id    = Maybe Int
chat_id_
          , message_id :: Maybe Int
message_id = Maybe Int
message_id_
          , media :: Maybe [PaidMedia]
media      = Maybe [PaidMedia]
media_
          }
      parseStarTransactionTypeChannelPaidMediaSale :: A.Value -> AT.Parser StarTransactionType
      parseStarTransactionTypeChannelPaidMediaSale :: Value -> Parser StarTransactionType
parseStarTransactionTypeChannelPaidMediaSale = String
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"StarTransactionTypeChannelPaidMediaSale" ((Object -> Parser StarTransactionType)
 -> Value -> Parser StarTransactionType)
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Int
user_id_    <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"user_id"
        Maybe Int
message_id_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"message_id"
        Maybe [PaidMedia]
media_      <- Object
o Object -> Key -> Parser (Maybe [PaidMedia])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"media"
        StarTransactionType -> Parser StarTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (StarTransactionType -> Parser StarTransactionType)
-> StarTransactionType -> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ StarTransactionTypeChannelPaidMediaSale
          { user_id :: Maybe Int
user_id    = Maybe Int
user_id_
          , message_id :: Maybe Int
message_id = Maybe Int
message_id_
          , media :: Maybe [PaidMedia]
media      = Maybe [PaidMedia]
media_
          }
      parseStarTransactionTypeBotInvoicePurchase :: A.Value -> AT.Parser StarTransactionType
      parseStarTransactionTypeBotInvoicePurchase :: Value -> Parser StarTransactionType
parseStarTransactionTypeBotInvoicePurchase = String
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"StarTransactionTypeBotInvoicePurchase" ((Object -> Parser StarTransactionType)
 -> Value -> Parser StarTransactionType)
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Int
user_id_      <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"user_id"
        Maybe ProductInfo
product_info_ <- Object
o Object -> Key -> Parser (Maybe ProductInfo)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"product_info"
        StarTransactionType -> Parser StarTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (StarTransactionType -> Parser StarTransactionType)
-> StarTransactionType -> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ StarTransactionTypeBotInvoicePurchase
          { user_id :: Maybe Int
user_id      = Maybe Int
user_id_
          , product_info :: Maybe ProductInfo
product_info = Maybe ProductInfo
product_info_
          }
      parseStarTransactionTypeBotInvoiceSale :: A.Value -> AT.Parser StarTransactionType
      parseStarTransactionTypeBotInvoiceSale :: Value -> Parser StarTransactionType
parseStarTransactionTypeBotInvoiceSale = String
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"StarTransactionTypeBotInvoiceSale" ((Object -> Parser StarTransactionType)
 -> Value -> Parser StarTransactionType)
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Int
user_id_         <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?                       Key
"user_id"
        Maybe ProductInfo
product_info_    <- Object
o Object -> Key -> Parser (Maybe ProductInfo)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?                       Key
"product_info"
        Maybe ByteString
invoice_payload_ <- (String -> ByteString) -> Maybe String -> Maybe ByteString
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> ByteString
I.readBytes (Maybe String -> Maybe ByteString)
-> Parser (Maybe String) -> Parser (Maybe ByteString)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o Object -> Key -> Parser (Maybe String)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"invoice_payload"
        Maybe AffiliateInfo
affiliate_       <- Object
o Object -> Key -> Parser (Maybe AffiliateInfo)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?                       Key
"affiliate"
        StarTransactionType -> Parser StarTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (StarTransactionType -> Parser StarTransactionType)
-> StarTransactionType -> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ StarTransactionTypeBotInvoiceSale
          { user_id :: Maybe Int
user_id         = Maybe Int
user_id_
          , product_info :: Maybe ProductInfo
product_info    = Maybe ProductInfo
product_info_
          , invoice_payload :: Maybe ByteString
invoice_payload = Maybe ByteString
invoice_payload_
          , affiliate :: Maybe AffiliateInfo
affiliate       = Maybe AffiliateInfo
affiliate_
          }
      parseStarTransactionTypeBotSubscriptionPurchase :: A.Value -> AT.Parser StarTransactionType
      parseStarTransactionTypeBotSubscriptionPurchase :: Value -> Parser StarTransactionType
parseStarTransactionTypeBotSubscriptionPurchase = String
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"StarTransactionTypeBotSubscriptionPurchase" ((Object -> Parser StarTransactionType)
 -> Value -> Parser StarTransactionType)
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Int
user_id_             <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"user_id"
        Maybe Int
subscription_period_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"subscription_period"
        Maybe ProductInfo
product_info_        <- Object
o Object -> Key -> Parser (Maybe ProductInfo)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"product_info"
        StarTransactionType -> Parser StarTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (StarTransactionType -> Parser StarTransactionType)
-> StarTransactionType -> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ StarTransactionTypeBotSubscriptionPurchase
          { user_id :: Maybe Int
user_id             = Maybe Int
user_id_
          , subscription_period :: Maybe Int
subscription_period = Maybe Int
subscription_period_
          , product_info :: Maybe ProductInfo
product_info        = Maybe ProductInfo
product_info_
          }
      parseStarTransactionTypeBotSubscriptionSale :: A.Value -> AT.Parser StarTransactionType
      parseStarTransactionTypeBotSubscriptionSale :: Value -> Parser StarTransactionType
parseStarTransactionTypeBotSubscriptionSale = String
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"StarTransactionTypeBotSubscriptionSale" ((Object -> Parser StarTransactionType)
 -> Value -> Parser StarTransactionType)
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Int
user_id_             <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?                       Key
"user_id"
        Maybe Int
subscription_period_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?                       Key
"subscription_period"
        Maybe ProductInfo
product_info_        <- Object
o Object -> Key -> Parser (Maybe ProductInfo)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?                       Key
"product_info"
        Maybe ByteString
invoice_payload_     <- (String -> ByteString) -> Maybe String -> Maybe ByteString
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> ByteString
I.readBytes (Maybe String -> Maybe ByteString)
-> Parser (Maybe String) -> Parser (Maybe ByteString)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
o Object -> Key -> Parser (Maybe String)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"invoice_payload"
        Maybe AffiliateInfo
affiliate_           <- Object
o Object -> Key -> Parser (Maybe AffiliateInfo)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?                       Key
"affiliate"
        StarTransactionType -> Parser StarTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (StarTransactionType -> Parser StarTransactionType)
-> StarTransactionType -> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ StarTransactionTypeBotSubscriptionSale
          { user_id :: Maybe Int
user_id             = Maybe Int
user_id_
          , subscription_period :: Maybe Int
subscription_period = Maybe Int
subscription_period_
          , product_info :: Maybe ProductInfo
product_info        = Maybe ProductInfo
product_info_
          , invoice_payload :: Maybe ByteString
invoice_payload     = Maybe ByteString
invoice_payload_
          , affiliate :: Maybe AffiliateInfo
affiliate           = Maybe AffiliateInfo
affiliate_
          }
      parseStarTransactionTypeChannelSubscriptionPurchase :: A.Value -> AT.Parser StarTransactionType
      parseStarTransactionTypeChannelSubscriptionPurchase :: Value -> Parser StarTransactionType
parseStarTransactionTypeChannelSubscriptionPurchase = String
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"StarTransactionTypeChannelSubscriptionPurchase" ((Object -> Parser StarTransactionType)
 -> Value -> Parser StarTransactionType)
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Int
chat_id_             <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"chat_id"
        Maybe Int
subscription_period_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"subscription_period"
        StarTransactionType -> Parser StarTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (StarTransactionType -> Parser StarTransactionType)
-> StarTransactionType -> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ StarTransactionTypeChannelSubscriptionPurchase
          { chat_id :: Maybe Int
chat_id             = Maybe Int
chat_id_
          , subscription_period :: Maybe Int
subscription_period = Maybe Int
subscription_period_
          }
      parseStarTransactionTypeChannelSubscriptionSale :: A.Value -> AT.Parser StarTransactionType
      parseStarTransactionTypeChannelSubscriptionSale :: Value -> Parser StarTransactionType
parseStarTransactionTypeChannelSubscriptionSale = String
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"StarTransactionTypeChannelSubscriptionSale" ((Object -> Parser StarTransactionType)
 -> Value -> Parser StarTransactionType)
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Int
user_id_             <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"user_id"
        Maybe Int
subscription_period_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"subscription_period"
        StarTransactionType -> Parser StarTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (StarTransactionType -> Parser StarTransactionType)
-> StarTransactionType -> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ StarTransactionTypeChannelSubscriptionSale
          { user_id :: Maybe Int
user_id             = Maybe Int
user_id_
          , subscription_period :: Maybe Int
subscription_period = Maybe Int
subscription_period_
          }
      parseStarTransactionTypeGiftPurchase :: A.Value -> AT.Parser StarTransactionType
      parseStarTransactionTypeGiftPurchase :: Value -> Parser StarTransactionType
parseStarTransactionTypeGiftPurchase = String
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"StarTransactionTypeGiftPurchase" ((Object -> Parser StarTransactionType)
 -> Value -> Parser StarTransactionType)
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Int
user_id_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"user_id"
        Maybe Gift
gift_    <- Object
o Object -> Key -> Parser (Maybe Gift)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"gift"
        StarTransactionType -> Parser StarTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (StarTransactionType -> Parser StarTransactionType)
-> StarTransactionType -> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ StarTransactionTypeGiftPurchase
          { user_id :: Maybe Int
user_id = Maybe Int
user_id_
          , gift :: Maybe Gift
gift    = Maybe Gift
gift_
          }
      parseStarTransactionTypeGiftTransfer :: A.Value -> AT.Parser StarTransactionType
      parseStarTransactionTypeGiftTransfer :: Value -> Parser StarTransactionType
parseStarTransactionTypeGiftTransfer = String
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"StarTransactionTypeGiftTransfer" ((Object -> Parser StarTransactionType)
 -> Value -> Parser StarTransactionType)
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Int
user_id_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"user_id"
        Maybe UpgradedGift
_gift_   <- Object
o Object -> Key -> Parser (Maybe UpgradedGift)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"gift"
        StarTransactionType -> Parser StarTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (StarTransactionType -> Parser StarTransactionType)
-> StarTransactionType -> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ StarTransactionTypeGiftTransfer
          { user_id :: Maybe Int
user_id = Maybe Int
user_id_
          , _gift :: Maybe UpgradedGift
_gift   = Maybe UpgradedGift
_gift_
          }
      parseStarTransactionTypeGiftSale :: A.Value -> AT.Parser StarTransactionType
      parseStarTransactionTypeGiftSale :: Value -> Parser StarTransactionType
parseStarTransactionTypeGiftSale = String
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"StarTransactionTypeGiftSale" ((Object -> Parser StarTransactionType)
 -> Value -> Parser StarTransactionType)
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Int
user_id_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"user_id"
        Maybe Gift
gift_    <- Object
o Object -> Key -> Parser (Maybe Gift)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"gift"
        StarTransactionType -> Parser StarTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (StarTransactionType -> Parser StarTransactionType)
-> StarTransactionType -> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ StarTransactionTypeGiftSale
          { user_id :: Maybe Int
user_id = Maybe Int
user_id_
          , gift :: Maybe Gift
gift    = Maybe Gift
gift_
          }
      parseStarTransactionTypeGiftUpgrade :: A.Value -> AT.Parser StarTransactionType
      parseStarTransactionTypeGiftUpgrade :: Value -> Parser StarTransactionType
parseStarTransactionTypeGiftUpgrade = String
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"StarTransactionTypeGiftUpgrade" ((Object -> Parser StarTransactionType)
 -> Value -> Parser StarTransactionType)
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe UpgradedGift
_gift_ <- Object
o Object -> Key -> Parser (Maybe UpgradedGift)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"gift"
        StarTransactionType -> Parser StarTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (StarTransactionType -> Parser StarTransactionType)
-> StarTransactionType -> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ StarTransactionTypeGiftUpgrade
          { _gift :: Maybe UpgradedGift
_gift = Maybe UpgradedGift
_gift_
          }
      parseStarTransactionTypeChannelPaidReactionSend :: A.Value -> AT.Parser StarTransactionType
      parseStarTransactionTypeChannelPaidReactionSend :: Value -> Parser StarTransactionType
parseStarTransactionTypeChannelPaidReactionSend = String
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"StarTransactionTypeChannelPaidReactionSend" ((Object -> Parser StarTransactionType)
 -> Value -> Parser StarTransactionType)
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Int
chat_id_    <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"chat_id"
        Maybe Int
message_id_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"message_id"
        StarTransactionType -> Parser StarTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (StarTransactionType -> Parser StarTransactionType)
-> StarTransactionType -> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ StarTransactionTypeChannelPaidReactionSend
          { chat_id :: Maybe Int
chat_id    = Maybe Int
chat_id_
          , message_id :: Maybe Int
message_id = Maybe Int
message_id_
          }
      parseStarTransactionTypeChannelPaidReactionReceive :: A.Value -> AT.Parser StarTransactionType
      parseStarTransactionTypeChannelPaidReactionReceive :: Value -> Parser StarTransactionType
parseStarTransactionTypeChannelPaidReactionReceive = String
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"StarTransactionTypeChannelPaidReactionReceive" ((Object -> Parser StarTransactionType)
 -> Value -> Parser StarTransactionType)
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Int
user_id_    <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"user_id"
        Maybe Int
message_id_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"message_id"
        StarTransactionType -> Parser StarTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (StarTransactionType -> Parser StarTransactionType)
-> StarTransactionType -> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ StarTransactionTypeChannelPaidReactionReceive
          { user_id :: Maybe Int
user_id    = Maybe Int
user_id_
          , message_id :: Maybe Int
message_id = Maybe Int
message_id_
          }
      parseStarTransactionTypeAffiliateProgramCommission :: A.Value -> AT.Parser StarTransactionType
      parseStarTransactionTypeAffiliateProgramCommission :: Value -> Parser StarTransactionType
parseStarTransactionTypeAffiliateProgramCommission = String
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"StarTransactionTypeAffiliateProgramCommission" ((Object -> Parser StarTransactionType)
 -> Value -> Parser StarTransactionType)
-> (Object -> Parser StarTransactionType)
-> Value
-> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Int
chat_id_              <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"chat_id"
        Maybe Int
commission_per_mille_ <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"commission_per_mille"
        StarTransactionType -> Parser StarTransactionType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (StarTransactionType -> Parser StarTransactionType)
-> StarTransactionType -> Parser StarTransactionType
forall a b. (a -> b) -> a -> b
$ StarTransactionTypeAffiliateProgramCommission
          { chat_id :: Maybe Int
chat_id              = Maybe Int
chat_id_
          , commission_per_mille :: Maybe Int
commission_per_mille = Maybe Int
commission_per_mille_
          }
  parseJSON Value
_ = Parser StarTransactionType
forall a. Monoid a => a
mempty