module TD.Query.SuggestUserProfilePhoto
  (SuggestUserProfilePhoto(..)
  , defaultSuggestUserProfilePhoto
  ) 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.InputChatPhoto as InputChatPhoto

-- | Suggests a profile photo to another regular user with common messages. Returns 'TD.Data.Ok.Ok'
data SuggestUserProfilePhoto
  = SuggestUserProfilePhoto
    { SuggestUserProfilePhoto -> Maybe Int
user_id :: Maybe Int                           -- ^ User identifier
    , SuggestUserProfilePhoto -> Maybe InputChatPhoto
photo   :: Maybe InputChatPhoto.InputChatPhoto -- ^ Profile photo to suggest; inputChatPhotoPrevious isn't supported in this function
    }
  deriving (SuggestUserProfilePhoto -> SuggestUserProfilePhoto -> Bool
(SuggestUserProfilePhoto -> SuggestUserProfilePhoto -> Bool)
-> (SuggestUserProfilePhoto -> SuggestUserProfilePhoto -> Bool)
-> Eq SuggestUserProfilePhoto
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SuggestUserProfilePhoto -> SuggestUserProfilePhoto -> Bool
== :: SuggestUserProfilePhoto -> SuggestUserProfilePhoto -> Bool
$c/= :: SuggestUserProfilePhoto -> SuggestUserProfilePhoto -> Bool
/= :: SuggestUserProfilePhoto -> SuggestUserProfilePhoto -> Bool
Eq, Int -> SuggestUserProfilePhoto -> ShowS
[SuggestUserProfilePhoto] -> ShowS
SuggestUserProfilePhoto -> String
(Int -> SuggestUserProfilePhoto -> ShowS)
-> (SuggestUserProfilePhoto -> String)
-> ([SuggestUserProfilePhoto] -> ShowS)
-> Show SuggestUserProfilePhoto
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SuggestUserProfilePhoto -> ShowS
showsPrec :: Int -> SuggestUserProfilePhoto -> ShowS
$cshow :: SuggestUserProfilePhoto -> String
show :: SuggestUserProfilePhoto -> String
$cshowList :: [SuggestUserProfilePhoto] -> ShowS
showList :: [SuggestUserProfilePhoto] -> ShowS
Show)

instance I.ShortShow SuggestUserProfilePhoto where
  shortShow :: SuggestUserProfilePhoto -> String
shortShow
    SuggestUserProfilePhoto
      { user_id :: SuggestUserProfilePhoto -> Maybe Int
user_id = Maybe Int
user_id_
      , photo :: SuggestUserProfilePhoto -> Maybe InputChatPhoto
photo   = Maybe InputChatPhoto
photo_
      }
        = String
"SuggestUserProfilePhoto"
          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
"photo"   String -> Maybe InputChatPhoto -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputChatPhoto
photo_
          ]

instance AT.ToJSON SuggestUserProfilePhoto where
  toJSON :: SuggestUserProfilePhoto -> Value
toJSON
    SuggestUserProfilePhoto
      { user_id :: SuggestUserProfilePhoto -> Maybe Int
user_id = Maybe Int
user_id_
      , photo :: SuggestUserProfilePhoto -> Maybe InputChatPhoto
photo   = Maybe InputChatPhoto
photo_
      }
        = [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
"suggestUserProfilePhoto"
          , 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
"photo"   Key -> Maybe InputChatPhoto -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputChatPhoto
photo_
          ]

defaultSuggestUserProfilePhoto :: SuggestUserProfilePhoto
defaultSuggestUserProfilePhoto :: SuggestUserProfilePhoto
defaultSuggestUserProfilePhoto =
  SuggestUserProfilePhoto
    { user_id :: Maybe Int
user_id = Maybe Int
forall a. Maybe a
Nothing
    , photo :: Maybe InputChatPhoto
photo   = Maybe InputChatPhoto
forall a. Maybe a
Nothing
    }