module TD.Query.RemoveTextCompositionStyle
  (RemoveTextCompositionStyle(..)
  ) where

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

-- | Removes a custom text composition style from the list of used by the user styles. If the style was created by the current user, then it can only be deleted. Returns 'TD.Data.Ok.Ok'
data RemoveTextCompositionStyle
  = RemoveTextCompositionStyle
    { RemoveTextCompositionStyle -> Maybe Text
name :: Maybe T.Text -- ^ Name of the style
    }
  deriving (RemoveTextCompositionStyle -> RemoveTextCompositionStyle -> Bool
(RemoveTextCompositionStyle -> RemoveTextCompositionStyle -> Bool)
-> (RemoveTextCompositionStyle
    -> RemoveTextCompositionStyle -> Bool)
-> Eq RemoveTextCompositionStyle
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RemoveTextCompositionStyle -> RemoveTextCompositionStyle -> Bool
== :: RemoveTextCompositionStyle -> RemoveTextCompositionStyle -> Bool
$c/= :: RemoveTextCompositionStyle -> RemoveTextCompositionStyle -> Bool
/= :: RemoveTextCompositionStyle -> RemoveTextCompositionStyle -> Bool
Eq, Int -> RemoveTextCompositionStyle -> ShowS
[RemoveTextCompositionStyle] -> ShowS
RemoveTextCompositionStyle -> String
(Int -> RemoveTextCompositionStyle -> ShowS)
-> (RemoveTextCompositionStyle -> String)
-> ([RemoveTextCompositionStyle] -> ShowS)
-> Show RemoveTextCompositionStyle
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RemoveTextCompositionStyle -> ShowS
showsPrec :: Int -> RemoveTextCompositionStyle -> ShowS
$cshow :: RemoveTextCompositionStyle -> String
show :: RemoveTextCompositionStyle -> String
$cshowList :: [RemoveTextCompositionStyle] -> ShowS
showList :: [RemoveTextCompositionStyle] -> ShowS
Show)

instance I.ShortShow RemoveTextCompositionStyle where
  shortShow :: RemoveTextCompositionStyle -> String
shortShow
    RemoveTextCompositionStyle
      { name :: RemoveTextCompositionStyle -> Maybe Text
name = Maybe Text
name_
      }
        = String
"RemoveTextCompositionStyle"
          String -> ShowS
forall a. [a] -> [a] -> [a]
++ [String] -> String
I.cc
          [ String
"name" String -> Maybe Text -> String
forall a. ShortShow a => String -> Maybe a -> String
`I.p` Maybe Text
name_
          ]

instance AT.ToJSON RemoveTextCompositionStyle where
  toJSON :: RemoveTextCompositionStyle -> Value
toJSON
    RemoveTextCompositionStyle
      { name :: RemoveTextCompositionStyle -> Maybe Text
name = Maybe Text
name_
      }
        = [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
"removeTextCompositionStyle"
          , Key
"name"  Key -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
A..= Maybe Text
name_
          ]