{-# LANGUAGE DeriveGeneric #-}
module Telegram.Bot.API.Types.User where

import Data.Aeson (FromJSON (..), ToJSON (..))
import Data.Text (Text)
import GHC.Generics (Generic)

import Telegram.Bot.API.Types.Common
import Telegram.Bot.API.Internal.Utils

-- ** User

-- | This object represents a Telegram user or bot.
--
-- <https://core.telegram.org/bots/api#user>
data User = User
  { User -> UserId
userId           :: UserId     -- ^ Unique identifier for this user or bot.
  , User -> Bool
userIsBot        :: Bool       -- ^ 'True', if this user is a bot.
  , User -> Text
userFirstName    :: Text       -- ^ User's or bot's first name.
  , User -> Maybe Text
userLastName     :: Maybe Text -- ^ User‘s or bot’s last name.
  , User -> Maybe Text
userUsername     :: Maybe Text -- ^ User‘s or bot’s username.
  , User -> Maybe Text
userLanguageCode :: Maybe Text -- ^ IETF language tag of the user's language.
  , User -> Maybe Bool
userIsPremium    :: Maybe Bool -- ^ 'True', if this user is a Telegram Premium user.
  , User -> Maybe Bool
userAddedToAttachmentMenu :: Maybe Bool -- ^ 'True', if this user added the bot to the attachment menu.
  , User -> Maybe Bool
userCanJoinGroups :: Maybe Bool -- ^ 'True', if the bot can be invited to groups. Returned only in `getMe`.
  , User -> Maybe Bool
userCanReadAllGroupMessages :: Maybe Bool -- ^ 'True', if privacy mode is disabled for the bot. Returned only in `getMe`.
  , User -> Maybe Bool
userSupportsInlineQueries :: Maybe Bool -- ^ 'True', if the bot supports inline queries. Returned only in `getMe`.
  }
  deriving (Int -> User -> ShowS
[User] -> ShowS
User -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [User] -> ShowS
$cshowList :: [User] -> ShowS
show :: User -> String
$cshow :: User -> String
showsPrec :: Int -> User -> ShowS
$cshowsPrec :: Int -> User -> ShowS
Show, forall x. Rep User x -> User
forall x. User -> Rep User x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep User x -> User
$cfrom :: forall x. User -> Rep User x
Generic)

instance ToJSON   User where toJSON :: User -> Value
toJSON = forall a (d :: Meta) (f :: * -> *).
(Generic a, GToJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
a -> Value
gtoJSON
instance FromJSON User where parseJSON :: Value -> Parser User
parseJSON = forall a (d :: Meta) (f :: * -> *).
(Generic a, GFromJSON Zero (Rep a), Rep a ~ D1 d f, Datatype d) =>
Value -> Parser a
gparseJSON