module TD.Query.GetSavedNotificationSound
  (GetSavedNotificationSound(..)
  ) where

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

-- | Returns saved notification sound by its identifier. Returns a 404 error if there is no saved notification sound with the specified identifier. Returns 'TD.Data.NotificationSounds.NotificationSounds'
data GetSavedNotificationSound
  = GetSavedNotificationSound
    { GetSavedNotificationSound -> Maybe Int
notification_sound_id :: Maybe Int -- ^ Identifier of the notification sound
    }
  deriving (GetSavedNotificationSound -> GetSavedNotificationSound -> Bool
(GetSavedNotificationSound -> GetSavedNotificationSound -> Bool)
-> (GetSavedNotificationSound -> GetSavedNotificationSound -> Bool)
-> Eq GetSavedNotificationSound
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GetSavedNotificationSound -> GetSavedNotificationSound -> Bool
== :: GetSavedNotificationSound -> GetSavedNotificationSound -> Bool
$c/= :: GetSavedNotificationSound -> GetSavedNotificationSound -> Bool
/= :: GetSavedNotificationSound -> GetSavedNotificationSound -> Bool
Eq, Int -> GetSavedNotificationSound -> ShowS
[GetSavedNotificationSound] -> ShowS
GetSavedNotificationSound -> String
(Int -> GetSavedNotificationSound -> ShowS)
-> (GetSavedNotificationSound -> String)
-> ([GetSavedNotificationSound] -> ShowS)
-> Show GetSavedNotificationSound
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GetSavedNotificationSound -> ShowS
showsPrec :: Int -> GetSavedNotificationSound -> ShowS
$cshow :: GetSavedNotificationSound -> String
show :: GetSavedNotificationSound -> String
$cshowList :: [GetSavedNotificationSound] -> ShowS
showList :: [GetSavedNotificationSound] -> ShowS
Show)

instance I.ShortShow GetSavedNotificationSound where
  shortShow :: GetSavedNotificationSound -> String
shortShow
    GetSavedNotificationSound
      { notification_sound_id :: GetSavedNotificationSound -> Maybe Int
notification_sound_id = Maybe Int
notification_sound_id_
      }
        = String
"GetSavedNotificationSound"
          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 GetSavedNotificationSound where
  toJSON :: GetSavedNotificationSound -> Value
toJSON
    GetSavedNotificationSound
      { notification_sound_id :: GetSavedNotificationSound -> 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
"getSavedNotificationSound"
          , 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_
          ]