module TD.Query.RemoveSavedAnimation
  (RemoveSavedAnimation(..)
  ) 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.InputFile as InputFile

-- | Removes an animation from the list of saved animations. Returns 'TD.Data.Ok.Ok'
data RemoveSavedAnimation
  = RemoveSavedAnimation
    { RemoveSavedAnimation -> Maybe InputFile
animation :: Maybe InputFile.InputFile -- ^ Animation file to be removed
    }
  deriving (RemoveSavedAnimation -> RemoveSavedAnimation -> Bool
(RemoveSavedAnimation -> RemoveSavedAnimation -> Bool)
-> (RemoveSavedAnimation -> RemoveSavedAnimation -> Bool)
-> Eq RemoveSavedAnimation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RemoveSavedAnimation -> RemoveSavedAnimation -> Bool
== :: RemoveSavedAnimation -> RemoveSavedAnimation -> Bool
$c/= :: RemoveSavedAnimation -> RemoveSavedAnimation -> Bool
/= :: RemoveSavedAnimation -> RemoveSavedAnimation -> Bool
Eq, Int -> RemoveSavedAnimation -> ShowS
[RemoveSavedAnimation] -> ShowS
RemoveSavedAnimation -> String
(Int -> RemoveSavedAnimation -> ShowS)
-> (RemoveSavedAnimation -> String)
-> ([RemoveSavedAnimation] -> ShowS)
-> Show RemoveSavedAnimation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RemoveSavedAnimation -> ShowS
showsPrec :: Int -> RemoveSavedAnimation -> ShowS
$cshow :: RemoveSavedAnimation -> String
show :: RemoveSavedAnimation -> String
$cshowList :: [RemoveSavedAnimation] -> ShowS
showList :: [RemoveSavedAnimation] -> ShowS
Show)

instance I.ShortShow RemoveSavedAnimation where
  shortShow :: RemoveSavedAnimation -> String
shortShow
    RemoveSavedAnimation
      { animation :: RemoveSavedAnimation -> Maybe InputFile
animation = Maybe InputFile
animation_
      }
        = String
"RemoveSavedAnimation"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"animation" String -> Maybe InputFile -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe InputFile
animation_
          ]

instance AT.ToJSON RemoveSavedAnimation where
  toJSON :: RemoveSavedAnimation -> Value
toJSON
    RemoveSavedAnimation
      { animation :: RemoveSavedAnimation -> Maybe InputFile
animation = Maybe InputFile
animation_
      }
        = [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
"removeSavedAnimation"
          , Key
"animation" Key -> Maybe InputFile -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe InputFile
animation_
          ]