module TD.Data.UserFullInfo
  (UserFullInfo(..)) 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.ChatPhoto as ChatPhoto
import qualified TD.Data.BlockList as BlockList
import qualified TD.Data.FormattedText as FormattedText
import qualified TD.Data.Birthdate as Birthdate
import qualified TD.Data.PremiumPaymentOption as PremiumPaymentOption
import qualified TD.Data.BusinessInfo as BusinessInfo
import qualified TD.Data.BotInfo as BotInfo

data UserFullInfo
  = UserFullInfo -- ^ Contains full information about a user
    { UserFullInfo -> Maybe ChatPhoto
personal_photo                               :: Maybe ChatPhoto.ChatPhoto                         -- ^ User profile photo set by the current user for the contact; may be null. If null and user.profile_photo is null, then the photo is empty; otherwise, it is unknown. If non-null, then it is the same photo as in user.profile_photo and chat.photo. This photo isn't returned in the list of user photos
    , UserFullInfo -> Maybe ChatPhoto
photo                                        :: Maybe ChatPhoto.ChatPhoto                         -- ^ User profile photo; may be null. If null and user.profile_photo is null, then the photo is empty; otherwise, it is unknown. If non-null and personal_photo is null, then it is the same photo as in user.profile_photo and chat.photo
    , UserFullInfo -> Maybe ChatPhoto
public_photo                                 :: Maybe ChatPhoto.ChatPhoto                         -- ^ User profile photo visible if the main photo is hidden by privacy settings; may be null. If null and user.profile_photo is null, then the photo is empty; otherwise, it is unknown. If non-null and both photo and personal_photo are null, then it is the same photo as in user.profile_photo and chat.photo. This photo isn't returned in the list of user photos
    , UserFullInfo -> Maybe BlockList
block_list                                   :: Maybe BlockList.BlockList                         -- ^ Block list to which the user is added; may be null if none
    , UserFullInfo -> Maybe Bool
can_be_called                                :: Maybe Bool                                        -- ^ True, if the user can be called
    , UserFullInfo -> Maybe Bool
supports_video_calls                         :: Maybe Bool                                        -- ^ True, if a video call can be created with the user
    , UserFullInfo -> Maybe Bool
has_private_calls                            :: Maybe Bool                                        -- ^ True, if the user can't be called due to their privacy settings
    , UserFullInfo -> Maybe Bool
has_private_forwards                         :: Maybe Bool                                        -- ^ True, if the user can't be linked in forwarded messages due to their privacy settings
    , UserFullInfo -> Maybe Bool
has_restricted_voice_and_video_note_messages :: Maybe Bool                                        -- ^ True, if voice and video notes can't be sent or forwarded to the user
    , UserFullInfo -> Maybe Bool
has_posted_to_profile_stories                :: Maybe Bool                                        -- ^ True, if the user has posted to profile stories
    , UserFullInfo -> Maybe Bool
has_sponsored_messages_enabled               :: Maybe Bool                                        -- ^ True, if the user always enabled sponsored messages; known only for the current user
    , UserFullInfo -> Maybe Bool
need_phone_number_privacy_exception          :: Maybe Bool                                        -- ^ True, if the current user needs to explicitly allow to share their phone number with the user when the method addContact is used
    , UserFullInfo -> Maybe Bool
set_chat_background                          :: Maybe Bool                                        -- ^ True, if the user set chat background for both chat users and it wasn't reverted yet
    , UserFullInfo -> Maybe FormattedText
bio                                          :: Maybe FormattedText.FormattedText                 -- ^ A short user bio; may be null for bots
    , UserFullInfo -> Maybe Birthdate
birthdate                                    :: Maybe Birthdate.Birthdate                         -- ^ Birthdate of the user; may be null if unknown
    , UserFullInfo -> Maybe Int
personal_chat_id                             :: Maybe Int                                         -- ^ Identifier of the personal chat of the user; 0 if none
    , UserFullInfo -> Maybe [PremiumPaymentOption]
premium_gift_options                         :: Maybe [PremiumPaymentOption.PremiumPaymentOption] -- ^ The list of available options for gifting Telegram Premium to the user
    , UserFullInfo -> Maybe Int
gift_count                                   :: Maybe Int                                         -- ^ Number of gifts saved to profile by the user
    , UserFullInfo -> Maybe Int
group_in_common_count                        :: Maybe Int                                         -- ^ Number of group chats where both the other user and the current user are a member; 0 for the current user
    , UserFullInfo -> Maybe BusinessInfo
business_info                                :: Maybe BusinessInfo.BusinessInfo                   -- ^ Information about business settings for Telegram Business accounts; may be null if none
    , UserFullInfo -> Maybe BotInfo
bot_info                                     :: Maybe BotInfo.BotInfo                             -- ^ For bots, information about the bot; may be null if the user isn't a bot
    }
  deriving (UserFullInfo -> UserFullInfo -> Bool
(UserFullInfo -> UserFullInfo -> Bool)
-> (UserFullInfo -> UserFullInfo -> Bool) -> Eq UserFullInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: UserFullInfo -> UserFullInfo -> Bool
== :: UserFullInfo -> UserFullInfo -> Bool
$c/= :: UserFullInfo -> UserFullInfo -> Bool
/= :: UserFullInfo -> UserFullInfo -> Bool
Eq, Int -> UserFullInfo -> ShowS
[UserFullInfo] -> ShowS
UserFullInfo -> String
(Int -> UserFullInfo -> ShowS)
-> (UserFullInfo -> String)
-> ([UserFullInfo] -> ShowS)
-> Show UserFullInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> UserFullInfo -> ShowS
showsPrec :: Int -> UserFullInfo -> ShowS
$cshow :: UserFullInfo -> String
show :: UserFullInfo -> String
$cshowList :: [UserFullInfo] -> ShowS
showList :: [UserFullInfo] -> ShowS
Show)

instance I.ShortShow UserFullInfo where
  shortShow :: UserFullInfo -> String
shortShow UserFullInfo
    { personal_photo :: UserFullInfo -> Maybe ChatPhoto
personal_photo                               = Maybe ChatPhoto
personal_photo_
    , photo :: UserFullInfo -> Maybe ChatPhoto
photo                                        = Maybe ChatPhoto
photo_
    , public_photo :: UserFullInfo -> Maybe ChatPhoto
public_photo                                 = Maybe ChatPhoto
public_photo_
    , block_list :: UserFullInfo -> Maybe BlockList
block_list                                   = Maybe BlockList
block_list_
    , can_be_called :: UserFullInfo -> Maybe Bool
can_be_called                                = Maybe Bool
can_be_called_
    , supports_video_calls :: UserFullInfo -> Maybe Bool
supports_video_calls                         = Maybe Bool
supports_video_calls_
    , has_private_calls :: UserFullInfo -> Maybe Bool
has_private_calls                            = Maybe Bool
has_private_calls_
    , has_private_forwards :: UserFullInfo -> Maybe Bool
has_private_forwards                         = Maybe Bool
has_private_forwards_
    , has_restricted_voice_and_video_note_messages :: UserFullInfo -> Maybe Bool
has_restricted_voice_and_video_note_messages = Maybe Bool
has_restricted_voice_and_video_note_messages_
    , has_posted_to_profile_stories :: UserFullInfo -> Maybe Bool
has_posted_to_profile_stories                = Maybe Bool
has_posted_to_profile_stories_
    , has_sponsored_messages_enabled :: UserFullInfo -> Maybe Bool
has_sponsored_messages_enabled               = Maybe Bool
has_sponsored_messages_enabled_
    , need_phone_number_privacy_exception :: UserFullInfo -> Maybe Bool
need_phone_number_privacy_exception          = Maybe Bool
need_phone_number_privacy_exception_
    , set_chat_background :: UserFullInfo -> Maybe Bool
set_chat_background                          = Maybe Bool
set_chat_background_
    , bio :: UserFullInfo -> Maybe FormattedText
bio                                          = Maybe FormattedText
bio_
    , birthdate :: UserFullInfo -> Maybe Birthdate
birthdate                                    = Maybe Birthdate
birthdate_
    , personal_chat_id :: UserFullInfo -> Maybe Int
personal_chat_id                             = Maybe Int
personal_chat_id_
    , premium_gift_options :: UserFullInfo -> Maybe [PremiumPaymentOption]
premium_gift_options                         = Maybe [PremiumPaymentOption]
premium_gift_options_
    , gift_count :: UserFullInfo -> Maybe Int
gift_count                                   = Maybe Int
gift_count_
    , group_in_common_count :: UserFullInfo -> Maybe Int
group_in_common_count                        = Maybe Int
group_in_common_count_
    , business_info :: UserFullInfo -> Maybe BusinessInfo
business_info                                = Maybe BusinessInfo
business_info_
    , bot_info :: UserFullInfo -> Maybe BotInfo
bot_info                                     = Maybe BotInfo
bot_info_
    }
      = String
"UserFullInfo"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"personal_photo"                               String -> Maybe ChatPhoto -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ChatPhoto
personal_photo_
        , String
"photo"                                        String -> Maybe ChatPhoto -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ChatPhoto
photo_
        , String
"public_photo"                                 String -> Maybe ChatPhoto -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ChatPhoto
public_photo_
        , String
"block_list"                                   String -> Maybe BlockList -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe BlockList
block_list_
        , String
"can_be_called"                                String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_be_called_
        , String
"supports_video_calls"                         String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
supports_video_calls_
        , String
"has_private_calls"                            String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
has_private_calls_
        , String
"has_private_forwards"                         String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
has_private_forwards_
        , String
"has_restricted_voice_and_video_note_messages" String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
has_restricted_voice_and_video_note_messages_
        , String
"has_posted_to_profile_stories"                String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
has_posted_to_profile_stories_
        , String
"has_sponsored_messages_enabled"               String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
has_sponsored_messages_enabled_
        , String
"need_phone_number_privacy_exception"          String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
need_phone_number_privacy_exception_
        , String
"set_chat_background"                          String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
set_chat_background_
        , String
"bio"                                          String -> Maybe FormattedText -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe FormattedText
bio_
        , String
"birthdate"                                    String -> Maybe Birthdate -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Birthdate
birthdate_
        , String
"personal_chat_id"                             String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
personal_chat_id_
        , String
"premium_gift_options"                         String -> Maybe [PremiumPaymentOption] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [PremiumPaymentOption]
premium_gift_options_
        , String
"gift_count"                                   String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
gift_count_
        , String
"group_in_common_count"                        String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
group_in_common_count_
        , String
"business_info"                                String -> Maybe BusinessInfo -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe BusinessInfo
business_info_
        , String
"bot_info"                                     String -> Maybe BotInfo -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe BotInfo
bot_info_
        ]

instance AT.FromJSON UserFullInfo where
  parseJSON :: Value -> Parser UserFullInfo
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
"userFullInfo" -> Value -> Parser UserFullInfo
parseUserFullInfo Value
v
      String
_              -> Parser UserFullInfo
forall a. Monoid a => a
mempty
    
    where
      parseUserFullInfo :: A.Value -> AT.Parser UserFullInfo
      parseUserFullInfo :: Value -> Parser UserFullInfo
parseUserFullInfo = String
-> (Object -> Parser UserFullInfo) -> Value -> Parser UserFullInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"UserFullInfo" ((Object -> Parser UserFullInfo) -> Value -> Parser UserFullInfo)
-> (Object -> Parser UserFullInfo) -> Value -> Parser UserFullInfo
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe ChatPhoto
personal_photo_                               <- Object
o Object -> Key -> Parser (Maybe ChatPhoto)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"personal_photo"
        Maybe ChatPhoto
photo_                                        <- Object
o Object -> Key -> Parser (Maybe ChatPhoto)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"photo"
        Maybe ChatPhoto
public_photo_                                 <- Object
o Object -> Key -> Parser (Maybe ChatPhoto)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"public_photo"
        Maybe BlockList
block_list_                                   <- Object
o Object -> Key -> Parser (Maybe BlockList)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"block_list"
        Maybe Bool
can_be_called_                                <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"can_be_called"
        Maybe Bool
supports_video_calls_                         <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"supports_video_calls"
        Maybe Bool
has_private_calls_                            <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"has_private_calls"
        Maybe Bool
has_private_forwards_                         <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"has_private_forwards"
        Maybe Bool
has_restricted_voice_and_video_note_messages_ <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"has_restricted_voice_and_video_note_messages"
        Maybe Bool
has_posted_to_profile_stories_                <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"has_posted_to_profile_stories"
        Maybe Bool
has_sponsored_messages_enabled_               <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"has_sponsored_messages_enabled"
        Maybe Bool
need_phone_number_privacy_exception_          <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"need_phone_number_privacy_exception"
        Maybe Bool
set_chat_background_                          <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"set_chat_background"
        Maybe FormattedText
bio_                                          <- Object
o Object -> Key -> Parser (Maybe FormattedText)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"bio"
        Maybe Birthdate
birthdate_                                    <- Object
o Object -> Key -> Parser (Maybe Birthdate)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"birthdate"
        Maybe Int
personal_chat_id_                             <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"personal_chat_id"
        Maybe [PremiumPaymentOption]
premium_gift_options_                         <- Object
o Object -> Key -> Parser (Maybe [PremiumPaymentOption])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"premium_gift_options"
        Maybe Int
gift_count_                                   <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"gift_count"
        Maybe Int
group_in_common_count_                        <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"group_in_common_count"
        Maybe BusinessInfo
business_info_                                <- Object
o Object -> Key -> Parser (Maybe BusinessInfo)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"business_info"
        Maybe BotInfo
bot_info_                                     <- Object
o Object -> Key -> Parser (Maybe BotInfo)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"bot_info"
        UserFullInfo -> Parser UserFullInfo
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (UserFullInfo -> Parser UserFullInfo)
-> UserFullInfo -> Parser UserFullInfo
forall a b. (a -> b) -> a -> b
$ UserFullInfo
          { personal_photo :: Maybe ChatPhoto
personal_photo                               = Maybe ChatPhoto
personal_photo_
          , photo :: Maybe ChatPhoto
photo                                        = Maybe ChatPhoto
photo_
          , public_photo :: Maybe ChatPhoto
public_photo                                 = Maybe ChatPhoto
public_photo_
          , block_list :: Maybe BlockList
block_list                                   = Maybe BlockList
block_list_
          , can_be_called :: Maybe Bool
can_be_called                                = Maybe Bool
can_be_called_
          , supports_video_calls :: Maybe Bool
supports_video_calls                         = Maybe Bool
supports_video_calls_
          , has_private_calls :: Maybe Bool
has_private_calls                            = Maybe Bool
has_private_calls_
          , has_private_forwards :: Maybe Bool
has_private_forwards                         = Maybe Bool
has_private_forwards_
          , has_restricted_voice_and_video_note_messages :: Maybe Bool
has_restricted_voice_and_video_note_messages = Maybe Bool
has_restricted_voice_and_video_note_messages_
          , has_posted_to_profile_stories :: Maybe Bool
has_posted_to_profile_stories                = Maybe Bool
has_posted_to_profile_stories_
          , has_sponsored_messages_enabled :: Maybe Bool
has_sponsored_messages_enabled               = Maybe Bool
has_sponsored_messages_enabled_
          , need_phone_number_privacy_exception :: Maybe Bool
need_phone_number_privacy_exception          = Maybe Bool
need_phone_number_privacy_exception_
          , set_chat_background :: Maybe Bool
set_chat_background                          = Maybe Bool
set_chat_background_
          , bio :: Maybe FormattedText
bio                                          = Maybe FormattedText
bio_
          , birthdate :: Maybe Birthdate
birthdate                                    = Maybe Birthdate
birthdate_
          , personal_chat_id :: Maybe Int
personal_chat_id                             = Maybe Int
personal_chat_id_
          , premium_gift_options :: Maybe [PremiumPaymentOption]
premium_gift_options                         = Maybe [PremiumPaymentOption]
premium_gift_options_
          , gift_count :: Maybe Int
gift_count                                   = Maybe Int
gift_count_
          , group_in_common_count :: Maybe Int
group_in_common_count                        = Maybe Int
group_in_common_count_
          , business_info :: Maybe BusinessInfo
business_info                                = Maybe BusinessInfo
business_info_
          , bot_info :: Maybe BotInfo
bot_info                                     = Maybe BotInfo
bot_info_
          }
  parseJSON Value
_ = Parser UserFullInfo
forall a. Monoid a => a
mempty