module TD.Query.DeleteProfilePhoto
  (DeleteProfilePhoto(..)
  ) where

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

-- | Deletes a profile photo. Returns 'TD.Data.Ok.Ok'
data DeleteProfilePhoto
  = DeleteProfilePhoto
    { DeleteProfilePhoto -> Maybe Int
profile_photo_id :: Maybe Int -- ^ Identifier of the profile photo to delete
    }
  deriving (DeleteProfilePhoto -> DeleteProfilePhoto -> Bool
(DeleteProfilePhoto -> DeleteProfilePhoto -> Bool)
-> (DeleteProfilePhoto -> DeleteProfilePhoto -> Bool)
-> Eq DeleteProfilePhoto
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DeleteProfilePhoto -> DeleteProfilePhoto -> Bool
== :: DeleteProfilePhoto -> DeleteProfilePhoto -> Bool
$c/= :: DeleteProfilePhoto -> DeleteProfilePhoto -> Bool
/= :: DeleteProfilePhoto -> DeleteProfilePhoto -> Bool
Eq, Int -> DeleteProfilePhoto -> ShowS
[DeleteProfilePhoto] -> ShowS
DeleteProfilePhoto -> String
(Int -> DeleteProfilePhoto -> ShowS)
-> (DeleteProfilePhoto -> String)
-> ([DeleteProfilePhoto] -> ShowS)
-> Show DeleteProfilePhoto
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DeleteProfilePhoto -> ShowS
showsPrec :: Int -> DeleteProfilePhoto -> ShowS
$cshow :: DeleteProfilePhoto -> String
show :: DeleteProfilePhoto -> String
$cshowList :: [DeleteProfilePhoto] -> ShowS
showList :: [DeleteProfilePhoto] -> ShowS
Show)

instance I.ShortShow DeleteProfilePhoto where
  shortShow :: DeleteProfilePhoto -> String
shortShow
    DeleteProfilePhoto
      { profile_photo_id :: DeleteProfilePhoto -> Maybe Int
profile_photo_id = Maybe Int
profile_photo_id_
      }
        = String
"DeleteProfilePhoto"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"profile_photo_id" String -> Maybe Int -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Int
profile_photo_id_
          ]

instance AT.ToJSON DeleteProfilePhoto where
  toJSON :: DeleteProfilePhoto -> Value
toJSON
    DeleteProfilePhoto
      { profile_photo_id :: DeleteProfilePhoto -> Maybe Int
profile_photo_id = Maybe Int
profile_photo_id_
      }
        = [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
"deleteProfilePhoto"
          , Key
"profile_photo_id" Key -> Maybe Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= (Int -> Value) -> Maybe Int -> Maybe Value
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Int -> Value
I.writeInt64  Maybe Int
profile_photo_id_
          ]