module TD.Data.BotInfo
  (BotInfo(..)) where

import qualified Data.Aeson as A
import qualified Data.Aeson.Types as AT
import qualified TD.Lib.Internal as I
import qualified Data.Text as T
import qualified TD.Data.Photo as Photo
import qualified TD.Data.Animation as Animation
import qualified TD.Data.BotMenuButton as BotMenuButton
import qualified TD.Data.BotCommand as BotCommand
import qualified TD.Data.ChatAdministratorRights as ChatAdministratorRights
import qualified TD.Data.AffiliateProgramInfo as AffiliateProgramInfo
import qualified TD.Data.BotVerificationParameters as BotVerificationParameters
import qualified TD.Data.InternalLinkType as InternalLinkType

data BotInfo
  = BotInfo -- ^ Contains information about a bot
    { BotInfo -> Maybe Text
short_description                    :: Maybe T.Text                                              -- ^ The text that is shown on the bot's profile page and is sent together with the link when users share the bot
    , BotInfo -> Maybe Text
description                          :: Maybe T.Text                                              -- ^ The text shown in the chat with the bot if the chat is empty
    , BotInfo -> Maybe Photo
photo                                :: Maybe Photo.Photo                                         -- ^ Photo shown in the chat with the bot if the chat is empty; may be null
    , BotInfo -> Maybe Animation
animation                            :: Maybe Animation.Animation                                 -- ^ Animation shown in the chat with the bot if the chat is empty; may be null
    , BotInfo -> Maybe BotMenuButton
menu_button                          :: Maybe BotMenuButton.BotMenuButton                         -- ^ Information about a button to show instead of the bot commands menu button; may be null if ordinary bot commands menu must be shown
    , BotInfo -> Maybe [BotCommand]
commands                             :: Maybe [BotCommand.BotCommand]                             -- ^ List of the bot commands
    , BotInfo -> Maybe Text
privacy_policy_url                   :: Maybe T.Text                                              -- ^ The HTTP link to the privacy policy of the bot. If empty, then /privacy command must be used if supported by the bot. If the command isn't supported, then https://telegram.org/privacy-tpa must be opened
    , BotInfo -> Maybe ChatAdministratorRights
default_group_administrator_rights   :: Maybe ChatAdministratorRights.ChatAdministratorRights     -- ^ Default administrator rights for adding the bot to basic group and supergroup chats; may be null
    , BotInfo -> Maybe ChatAdministratorRights
default_channel_administrator_rights :: Maybe ChatAdministratorRights.ChatAdministratorRights     -- ^ Default administrator rights for adding the bot to channels; may be null
    , BotInfo -> Maybe AffiliateProgramInfo
affiliate_program                    :: Maybe AffiliateProgramInfo.AffiliateProgramInfo           -- ^ Information about the affiliate program of the bot; may be null if none
    , BotInfo -> Maybe Int
web_app_background_light_color       :: Maybe Int                                                 -- ^ Default light background color for bot Web Apps; -1 if not specified
    , BotInfo -> Maybe Int
web_app_background_dark_color        :: Maybe Int                                                 -- ^ Default dark background color for bot Web Apps; -1 if not specified
    , BotInfo -> Maybe Int
web_app_header_light_color           :: Maybe Int                                                 -- ^ Default light header color for bot Web Apps; -1 if not specified
    , BotInfo -> Maybe Int
web_app_header_dark_color            :: Maybe Int                                                 -- ^ Default dark header color for bot Web Apps; -1 if not specified
    , BotInfo -> Maybe BotVerificationParameters
verification_parameters              :: Maybe BotVerificationParameters.BotVerificationParameters -- ^ Parameters of the verification that can be provided by the bot; may be null if none or the current user isn't the owner of the bot
    , BotInfo -> Maybe Bool
can_get_revenue_statistics           :: Maybe Bool                                                -- ^ True, if the bot's revenue statistics are available to the current user
    , BotInfo -> Maybe Bool
can_manage_emoji_status              :: Maybe Bool                                                -- ^ True, if the bot can manage emoji status of the current user
    , BotInfo -> Maybe Bool
has_media_previews                   :: Maybe Bool                                                -- ^ True, if the bot has media previews
    , BotInfo -> Maybe InternalLinkType
edit_commands_link                   :: Maybe InternalLinkType.InternalLinkType                   -- ^ The internal link, which can be used to edit bot commands; may be null
    , BotInfo -> Maybe InternalLinkType
edit_description_link                :: Maybe InternalLinkType.InternalLinkType                   -- ^ The internal link, which can be used to edit bot description; may be null
    , BotInfo -> Maybe InternalLinkType
edit_description_media_link          :: Maybe InternalLinkType.InternalLinkType                   -- ^ The internal link, which can be used to edit the photo or animation shown in the chat with the bot if the chat is empty; may be null
    , BotInfo -> Maybe InternalLinkType
edit_settings_link                   :: Maybe InternalLinkType.InternalLinkType                   -- ^ The internal link, which can be used to edit bot settings; may be null
    }
  deriving (BotInfo -> BotInfo -> Bool
(BotInfo -> BotInfo -> Bool)
-> (BotInfo -> BotInfo -> Bool) -> Eq BotInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BotInfo -> BotInfo -> Bool
== :: BotInfo -> BotInfo -> Bool
$c/= :: BotInfo -> BotInfo -> Bool
/= :: BotInfo -> BotInfo -> Bool
Eq, Int -> BotInfo -> ShowS
[BotInfo] -> ShowS
BotInfo -> String
(Int -> BotInfo -> ShowS)
-> (BotInfo -> String) -> ([BotInfo] -> ShowS) -> Show BotInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BotInfo -> ShowS
showsPrec :: Int -> BotInfo -> ShowS
$cshow :: BotInfo -> String
show :: BotInfo -> String
$cshowList :: [BotInfo] -> ShowS
showList :: [BotInfo] -> ShowS
Show)

instance I.ShortShow BotInfo where
  shortShow :: BotInfo -> String
shortShow BotInfo
    { short_description :: BotInfo -> Maybe Text
short_description                    = Maybe Text
short_description_
    , description :: BotInfo -> Maybe Text
description                          = Maybe Text
description_
    , photo :: BotInfo -> Maybe Photo
photo                                = Maybe Photo
photo_
    , animation :: BotInfo -> Maybe Animation
animation                            = Maybe Animation
animation_
    , menu_button :: BotInfo -> Maybe BotMenuButton
menu_button                          = Maybe BotMenuButton
menu_button_
    , commands :: BotInfo -> Maybe [BotCommand]
commands                             = Maybe [BotCommand]
commands_
    , privacy_policy_url :: BotInfo -> Maybe Text
privacy_policy_url                   = Maybe Text
privacy_policy_url_
    , default_group_administrator_rights :: BotInfo -> Maybe ChatAdministratorRights
default_group_administrator_rights   = Maybe ChatAdministratorRights
default_group_administrator_rights_
    , default_channel_administrator_rights :: BotInfo -> Maybe ChatAdministratorRights
default_channel_administrator_rights = Maybe ChatAdministratorRights
default_channel_administrator_rights_
    , affiliate_program :: BotInfo -> Maybe AffiliateProgramInfo
affiliate_program                    = Maybe AffiliateProgramInfo
affiliate_program_
    , web_app_background_light_color :: BotInfo -> Maybe Int
web_app_background_light_color       = Maybe Int
web_app_background_light_color_
    , web_app_background_dark_color :: BotInfo -> Maybe Int
web_app_background_dark_color        = Maybe Int
web_app_background_dark_color_
    , web_app_header_light_color :: BotInfo -> Maybe Int
web_app_header_light_color           = Maybe Int
web_app_header_light_color_
    , web_app_header_dark_color :: BotInfo -> Maybe Int
web_app_header_dark_color            = Maybe Int
web_app_header_dark_color_
    , verification_parameters :: BotInfo -> Maybe BotVerificationParameters
verification_parameters              = Maybe BotVerificationParameters
verification_parameters_
    , can_get_revenue_statistics :: BotInfo -> Maybe Bool
can_get_revenue_statistics           = Maybe Bool
can_get_revenue_statistics_
    , can_manage_emoji_status :: BotInfo -> Maybe Bool
can_manage_emoji_status              = Maybe Bool
can_manage_emoji_status_
    , has_media_previews :: BotInfo -> Maybe Bool
has_media_previews                   = Maybe Bool
has_media_previews_
    , edit_commands_link :: BotInfo -> Maybe InternalLinkType
edit_commands_link                   = Maybe InternalLinkType
edit_commands_link_
    , edit_description_link :: BotInfo -> Maybe InternalLinkType
edit_description_link                = Maybe InternalLinkType
edit_description_link_
    , edit_description_media_link :: BotInfo -> Maybe InternalLinkType
edit_description_media_link          = Maybe InternalLinkType
edit_description_media_link_
    , edit_settings_link :: BotInfo -> Maybe InternalLinkType
edit_settings_link                   = Maybe InternalLinkType
edit_settings_link_
    }
      = String
"BotInfo"
        String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
        [ String
"short_description"                    String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
short_description_
        , String
"description"                          String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
description_
        , String
"photo"                                String -> Maybe Photo -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Photo
photo_
        , String
"animation"                            String -> Maybe Animation -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Animation
animation_
        , String
"menu_button"                          String -> Maybe BotMenuButton -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe BotMenuButton
menu_button_
        , String
"commands"                             String -> Maybe [BotCommand] -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe [BotCommand]
commands_
        , String
"privacy_policy_url"                   String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
privacy_policy_url_
        , String
"default_group_administrator_rights"   String -> Maybe ChatAdministratorRights -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ChatAdministratorRights
default_group_administrator_rights_
        , String
"default_channel_administrator_rights" String -> Maybe ChatAdministratorRights -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe ChatAdministratorRights
default_channel_administrator_rights_
        , String
"affiliate_program"                    String -> Maybe AffiliateProgramInfo -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe AffiliateProgramInfo
affiliate_program_
        , String
"web_app_background_light_color"       String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
web_app_background_light_color_
        , String
"web_app_background_dark_color"        String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
web_app_background_dark_color_
        , String
"web_app_header_light_color"           String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
web_app_header_light_color_
        , String
"web_app_header_dark_color"            String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
web_app_header_dark_color_
        , String
"verification_parameters"              String -> Maybe BotVerificationParameters -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe BotVerificationParameters
verification_parameters_
        , String
"can_get_revenue_statistics"           String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_get_revenue_statistics_
        , String
"can_manage_emoji_status"              String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
can_manage_emoji_status_
        , String
"has_media_previews"                   String -> Maybe Bool -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Bool
has_media_previews_
        , String
"edit_commands_link"                   String -> Maybe InternalLinkType -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InternalLinkType
edit_commands_link_
        , String
"edit_description_link"                String -> Maybe InternalLinkType -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InternalLinkType
edit_description_link_
        , String
"edit_description_media_link"          String -> Maybe InternalLinkType -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InternalLinkType
edit_description_media_link_
        , String
"edit_settings_link"                   String -> Maybe InternalLinkType -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InternalLinkType
edit_settings_link_
        ]

instance AT.FromJSON BotInfo where
  parseJSON :: Value -> Parser BotInfo
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
"botInfo" -> Value -> Parser BotInfo
parseBotInfo Value
v
      String
_         -> Parser BotInfo
forall a. Monoid a => a
mempty
    
    where
      parseBotInfo :: A.Value -> AT.Parser BotInfo
      parseBotInfo :: Value -> Parser BotInfo
parseBotInfo = String -> (Object -> Parser BotInfo) -> Value -> Parser BotInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
A.withObject String
"BotInfo" ((Object -> Parser BotInfo) -> Value -> Parser BotInfo)
-> (Object -> Parser BotInfo) -> Value -> Parser BotInfo
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
        Maybe Text
short_description_                    <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"short_description"
        Maybe Text
description_                          <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"description"
        Maybe Photo
photo_                                <- Object
o Object -> Key -> Parser (Maybe Photo)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"photo"
        Maybe Animation
animation_                            <- Object
o Object -> Key -> Parser (Maybe Animation)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"animation"
        Maybe BotMenuButton
menu_button_                          <- Object
o Object -> Key -> Parser (Maybe BotMenuButton)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"menu_button"
        Maybe [BotCommand]
commands_                             <- Object
o Object -> Key -> Parser (Maybe [BotCommand])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"commands"
        Maybe Text
privacy_policy_url_                   <- Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"privacy_policy_url"
        Maybe ChatAdministratorRights
default_group_administrator_rights_   <- Object
o Object -> Key -> Parser (Maybe ChatAdministratorRights)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"default_group_administrator_rights"
        Maybe ChatAdministratorRights
default_channel_administrator_rights_ <- Object
o Object -> Key -> Parser (Maybe ChatAdministratorRights)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"default_channel_administrator_rights"
        Maybe AffiliateProgramInfo
affiliate_program_                    <- Object
o Object -> Key -> Parser (Maybe AffiliateProgramInfo)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"affiliate_program"
        Maybe Int
web_app_background_light_color_       <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"web_app_background_light_color"
        Maybe Int
web_app_background_dark_color_        <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"web_app_background_dark_color"
        Maybe Int
web_app_header_light_color_           <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"web_app_header_light_color"
        Maybe Int
web_app_header_dark_color_            <- Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"web_app_header_dark_color"
        Maybe BotVerificationParameters
verification_parameters_              <- Object
o Object -> Key -> Parser (Maybe BotVerificationParameters)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"verification_parameters"
        Maybe Bool
can_get_revenue_statistics_           <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"can_get_revenue_statistics"
        Maybe Bool
can_manage_emoji_status_              <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"can_manage_emoji_status"
        Maybe Bool
has_media_previews_                   <- Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"has_media_previews"
        Maybe InternalLinkType
edit_commands_link_                   <- Object
o Object -> Key -> Parser (Maybe InternalLinkType)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"edit_commands_link"
        Maybe InternalLinkType
edit_description_link_                <- Object
o Object -> Key -> Parser (Maybe InternalLinkType)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"edit_description_link"
        Maybe InternalLinkType
edit_description_media_link_          <- Object
o Object -> Key -> Parser (Maybe InternalLinkType)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"edit_description_media_link"
        Maybe InternalLinkType
edit_settings_link_                   <- Object
o Object -> Key -> Parser (Maybe InternalLinkType)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
A..:?  Key
"edit_settings_link"
        BotInfo -> Parser BotInfo
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (BotInfo -> Parser BotInfo) -> BotInfo -> Parser BotInfo
forall a b. (a -> b) -> a -> b
$ BotInfo
          { short_description :: Maybe Text
short_description                    = Maybe Text
short_description_
          , description :: Maybe Text
description                          = Maybe Text
description_
          , photo :: Maybe Photo
photo                                = Maybe Photo
photo_
          , animation :: Maybe Animation
animation                            = Maybe Animation
animation_
          , menu_button :: Maybe BotMenuButton
menu_button                          = Maybe BotMenuButton
menu_button_
          , commands :: Maybe [BotCommand]
commands                             = Maybe [BotCommand]
commands_
          , privacy_policy_url :: Maybe Text
privacy_policy_url                   = Maybe Text
privacy_policy_url_
          , default_group_administrator_rights :: Maybe ChatAdministratorRights
default_group_administrator_rights   = Maybe ChatAdministratorRights
default_group_administrator_rights_
          , default_channel_administrator_rights :: Maybe ChatAdministratorRights
default_channel_administrator_rights = Maybe ChatAdministratorRights
default_channel_administrator_rights_
          , affiliate_program :: Maybe AffiliateProgramInfo
affiliate_program                    = Maybe AffiliateProgramInfo
affiliate_program_
          , web_app_background_light_color :: Maybe Int
web_app_background_light_color       = Maybe Int
web_app_background_light_color_
          , web_app_background_dark_color :: Maybe Int
web_app_background_dark_color        = Maybe Int
web_app_background_dark_color_
          , web_app_header_light_color :: Maybe Int
web_app_header_light_color           = Maybe Int
web_app_header_light_color_
          , web_app_header_dark_color :: Maybe Int
web_app_header_dark_color            = Maybe Int
web_app_header_dark_color_
          , verification_parameters :: Maybe BotVerificationParameters
verification_parameters              = Maybe BotVerificationParameters
verification_parameters_
          , can_get_revenue_statistics :: Maybe Bool
can_get_revenue_statistics           = Maybe Bool
can_get_revenue_statistics_
          , can_manage_emoji_status :: Maybe Bool
can_manage_emoji_status              = Maybe Bool
can_manage_emoji_status_
          , has_media_previews :: Maybe Bool
has_media_previews                   = Maybe Bool
has_media_previews_
          , edit_commands_link :: Maybe InternalLinkType
edit_commands_link                   = Maybe InternalLinkType
edit_commands_link_
          , edit_description_link :: Maybe InternalLinkType
edit_description_link                = Maybe InternalLinkType
edit_description_link_
          , edit_description_media_link :: Maybe InternalLinkType
edit_description_media_link          = Maybe InternalLinkType
edit_description_media_link_
          , edit_settings_link :: Maybe InternalLinkType
edit_settings_link                   = Maybe InternalLinkType
edit_settings_link_
          }
  parseJSON Value
_ = Parser BotInfo
forall a. Monoid a => a
mempty