module TD.Query.IsProfileAudio
  (IsProfileAudio(..)
  ) where

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

-- | Checks whether a file is in the profile audio files of the current user. Returns a 404 error if it isn't. Returns 'TD.Data.Ok.Ok'
data IsProfileAudio
  = IsProfileAudio
    { IsProfileAudio -> Maybe Int
file_id :: Maybe Int -- ^ Identifier of the audio file to check
    }
  deriving (IsProfileAudio -> IsProfileAudio -> Bool
(IsProfileAudio -> IsProfileAudio -> Bool)
-> (IsProfileAudio -> IsProfileAudio -> Bool) -> Eq IsProfileAudio
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: IsProfileAudio -> IsProfileAudio -> Bool
== :: IsProfileAudio -> IsProfileAudio -> Bool
$c/= :: IsProfileAudio -> IsProfileAudio -> Bool
/= :: IsProfileAudio -> IsProfileAudio -> Bool
Eq, Int -> IsProfileAudio -> ShowS
[IsProfileAudio] -> ShowS
IsProfileAudio -> String
(Int -> IsProfileAudio -> ShowS)
-> (IsProfileAudio -> String)
-> ([IsProfileAudio] -> ShowS)
-> Show IsProfileAudio
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> IsProfileAudio -> ShowS
showsPrec :: Int -> IsProfileAudio -> ShowS
$cshow :: IsProfileAudio -> String
show :: IsProfileAudio -> String
$cshowList :: [IsProfileAudio] -> ShowS
showList :: [IsProfileAudio] -> ShowS
Show)

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

instance AT.ToJSON IsProfileAudio where
  toJSON :: IsProfileAudio -> Value
toJSON
    IsProfileAudio
      { file_id :: IsProfileAudio -> Maybe Int
file_id = Maybe Int
file_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
"isProfileAudio"
          , Key
"file_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
file_id_
          ]