module TD.Query.GetUserProfilePhotos
  (GetUserProfilePhotos(..)
  , defaultGetUserProfilePhotos
  ) where

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

-- | Returns the profile photos of a user. Personal and public photo aren't returned. Returns 'TD.Data.ChatPhotos.ChatPhotos'
data GetUserProfilePhotos
  = GetUserProfilePhotos
    { GetUserProfilePhotos -> Maybe Int
user_id :: Maybe Int -- ^ User identifier
    , GetUserProfilePhotos -> Maybe Int
offset  :: Maybe Int -- ^ The number of photos to skip; must be non-negative
    , GetUserProfilePhotos -> Maybe Int
limit   :: Maybe Int -- ^ The maximum number of photos to be returned; up to 100
    }
  deriving (GetUserProfilePhotos -> GetUserProfilePhotos -> Bool
(GetUserProfilePhotos -> GetUserProfilePhotos -> Bool)
-> (GetUserProfilePhotos -> GetUserProfilePhotos -> Bool)
-> Eq GetUserProfilePhotos
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetUserProfilePhotos -> GetUserProfilePhotos -> Bool
== :: GetUserProfilePhotos -> GetUserProfilePhotos -> Bool
$c/= :: GetUserProfilePhotos -> GetUserProfilePhotos -> Bool
/= :: GetUserProfilePhotos -> GetUserProfilePhotos -> Bool
Eq, Int -> GetUserProfilePhotos -> ShowS
[GetUserProfilePhotos] -> ShowS
GetUserProfilePhotos -> String
(Int -> GetUserProfilePhotos -> ShowS)
-> (GetUserProfilePhotos -> String)
-> ([GetUserProfilePhotos] -> ShowS)
-> Show GetUserProfilePhotos
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetUserProfilePhotos -> ShowS
showsPrec :: Int -> GetUserProfilePhotos -> ShowS
$cshow :: GetUserProfilePhotos -> String
show :: GetUserProfilePhotos -> String
$cshowList :: [GetUserProfilePhotos] -> ShowS
showList :: [GetUserProfilePhotos] -> ShowS
Show)

instance I.ShortShow GetUserProfilePhotos where
  shortShow :: GetUserProfilePhotos -> String
shortShow
    GetUserProfilePhotos
      { user_id :: GetUserProfilePhotos -> Maybe Int
user_id = Maybe Int
user_id_
      , offset :: GetUserProfilePhotos -> Maybe Int
offset  = Maybe Int
offset_
      , limit :: GetUserProfilePhotos -> Maybe Int
limit   = Maybe Int
limit_
      }
        = String
"GetUserProfilePhotos"
          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
"offset"  String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
offset_
          , String
"limit"   String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
limit_
          ]

instance AT.ToJSON GetUserProfilePhotos where
  toJSON :: GetUserProfilePhotos -> Value
toJSON
    GetUserProfilePhotos
      { user_id :: GetUserProfilePhotos -> Maybe Int
user_id = Maybe Int
user_id_
      , offset :: GetUserProfilePhotos -> Maybe Int
offset  = Maybe Int
offset_
      , limit :: GetUserProfilePhotos -> Maybe Int
limit   = Maybe Int
limit_
      }
        = [Pair] -> Value
A.object
          [ Key
"@type"   Key -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Text -> Value
AT.String Text
"getUserProfilePhotos"
          , Key
"user_id" Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
user_id_
          , Key
"offset"  Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
offset_
          , Key
"limit"   Key -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Int
limit_
          ]

defaultGetUserProfilePhotos :: GetUserProfilePhotos
defaultGetUserProfilePhotos :: GetUserProfilePhotos
defaultGetUserProfilePhotos =
  GetUserProfilePhotos
    { user_id :: Maybe Int
user_id = Maybe Int
forall a. Maybe a
Nothing
    , offset :: Maybe Int
offset  = Maybe Int
forall a. Maybe a
Nothing
    , limit :: Maybe Int
limit   = Maybe Int
forall a. Maybe a
Nothing
    }