module TD.Query.RemoveSavedNotificationSound
  (RemoveSavedNotificationSound(..)
  ) where

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

-- | Removes a notification sound from the list of saved notification sounds. Returns 'TD.Data.Ok.Ok'
data RemoveSavedNotificationSound
  = RemoveSavedNotificationSound
    { RemoveSavedNotificationSound -> Maybe Int
notification_sound_id :: Maybe Int -- ^ Identifier of the notification sound
    }
  deriving (RemoveSavedNotificationSound
-> RemoveSavedNotificationSound -> Bool
(RemoveSavedNotificationSound
 -> RemoveSavedNotificationSound -> Bool)
-> (RemoveSavedNotificationSound
    -> RemoveSavedNotificationSound -> Bool)
-> Eq RemoveSavedNotificationSound
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RemoveSavedNotificationSound
-> RemoveSavedNotificationSound -> Bool
== :: RemoveSavedNotificationSound
-> RemoveSavedNotificationSound -> Bool
$c/= :: RemoveSavedNotificationSound
-> RemoveSavedNotificationSound -> Bool
/= :: RemoveSavedNotificationSound
-> RemoveSavedNotificationSound -> Bool
Eq, Int -> RemoveSavedNotificationSound -> ShowS
[RemoveSavedNotificationSound] -> ShowS
RemoveSavedNotificationSound -> String
(Int -> RemoveSavedNotificationSound -> ShowS)
-> (RemoveSavedNotificationSound -> String)
-> ([RemoveSavedNotificationSound] -> ShowS)
-> Show RemoveSavedNotificationSound
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RemoveSavedNotificationSound -> ShowS
showsPrec :: Int -> RemoveSavedNotificationSound -> ShowS
$cshow :: RemoveSavedNotificationSound -> String
show :: RemoveSavedNotificationSound -> String
$cshowList :: [RemoveSavedNotificationSound] -> ShowS
showList :: [RemoveSavedNotificationSound] -> ShowS
Show)

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

instance AT.ToJSON RemoveSavedNotificationSound where
  toJSON :: RemoveSavedNotificationSound -> Value
toJSON
    RemoveSavedNotificationSound
      { notification_sound_id :: RemoveSavedNotificationSound -> Maybe Int
notification_sound_id = Maybe Int
notification_sound_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
"removeSavedNotificationSound"
          , Key
"notification_sound_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
notification_sound_id_
          ]