{- ORMOLU_DISABLE -}
{- HLINT ignore -}
-- THIS IS A GENERATED FILE, DO NOT EDIT

{-# OPTIONS_GHC -Wno-unused-imports #-}
{-# OPTIONS_GHC -Wno-unused-matches #-}
{-# OPTIONS_GHC -Wno-deprecations #-}
module Language.LSP.Protocol.Internal.Types.ExecuteCommandParams where

import Control.DeepSeq
import Data.Hashable
import GHC.Generics
import Language.LSP.Protocol.Utils.Misc
import Prettyprinter
import qualified Data.Aeson
import qualified Data.Aeson as Aeson
import qualified Data.Row.Aeson as Aeson
import qualified Data.Row.Hashable as Hashable
import qualified Data.Text
import qualified Language.LSP.Protocol.Internal.Types.ProgressToken
import qualified Language.LSP.Protocol.Types.Common

{-|
The parameters of a `ExecuteCommandRequest`.
-}
data ExecuteCommandParams = ExecuteCommandParams 
  { {-|
  An optional token that a server can use to report work done progress.
  -}
  ExecuteCommandParams -> Maybe ProgressToken
_workDoneToken :: (Maybe Language.LSP.Protocol.Internal.Types.ProgressToken.ProgressToken)
  , {-|
  The identifier of the actual command handler.
  -}
  ExecuteCommandParams -> Text
_command :: Data.Text.Text
  , {-|
  Arguments that the command should be invoked with.
  -}
  ExecuteCommandParams -> Maybe [Value]
_arguments :: (Maybe [Data.Aeson.Value])
  }
  deriving stock (Int -> ExecuteCommandParams -> ShowS
[ExecuteCommandParams] -> ShowS
ExecuteCommandParams -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExecuteCommandParams] -> ShowS
$cshowList :: [ExecuteCommandParams] -> ShowS
show :: ExecuteCommandParams -> String
$cshow :: ExecuteCommandParams -> String
showsPrec :: Int -> ExecuteCommandParams -> ShowS
$cshowsPrec :: Int -> ExecuteCommandParams -> ShowS
Show, ExecuteCommandParams -> ExecuteCommandParams -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExecuteCommandParams -> ExecuteCommandParams -> Bool
$c/= :: ExecuteCommandParams -> ExecuteCommandParams -> Bool
== :: ExecuteCommandParams -> ExecuteCommandParams -> Bool
$c== :: ExecuteCommandParams -> ExecuteCommandParams -> Bool
Eq, Eq ExecuteCommandParams
ExecuteCommandParams -> ExecuteCommandParams -> Bool
ExecuteCommandParams -> ExecuteCommandParams -> Ordering
ExecuteCommandParams
-> ExecuteCommandParams -> ExecuteCommandParams
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: ExecuteCommandParams
-> ExecuteCommandParams -> ExecuteCommandParams
$cmin :: ExecuteCommandParams
-> ExecuteCommandParams -> ExecuteCommandParams
max :: ExecuteCommandParams
-> ExecuteCommandParams -> ExecuteCommandParams
$cmax :: ExecuteCommandParams
-> ExecuteCommandParams -> ExecuteCommandParams
>= :: ExecuteCommandParams -> ExecuteCommandParams -> Bool
$c>= :: ExecuteCommandParams -> ExecuteCommandParams -> Bool
> :: ExecuteCommandParams -> ExecuteCommandParams -> Bool
$c> :: ExecuteCommandParams -> ExecuteCommandParams -> Bool
<= :: ExecuteCommandParams -> ExecuteCommandParams -> Bool
$c<= :: ExecuteCommandParams -> ExecuteCommandParams -> Bool
< :: ExecuteCommandParams -> ExecuteCommandParams -> Bool
$c< :: ExecuteCommandParams -> ExecuteCommandParams -> Bool
compare :: ExecuteCommandParams -> ExecuteCommandParams -> Ordering
$ccompare :: ExecuteCommandParams -> ExecuteCommandParams -> Ordering
Ord, forall x. Rep ExecuteCommandParams x -> ExecuteCommandParams
forall x. ExecuteCommandParams -> Rep ExecuteCommandParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExecuteCommandParams x -> ExecuteCommandParams
$cfrom :: forall x. ExecuteCommandParams -> Rep ExecuteCommandParams x
Generic)
  deriving anyclass (ExecuteCommandParams -> ()
forall a. (a -> ()) -> NFData a
rnf :: ExecuteCommandParams -> ()
$crnf :: ExecuteCommandParams -> ()
NFData, Eq ExecuteCommandParams
Int -> ExecuteCommandParams -> Int
ExecuteCommandParams -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: ExecuteCommandParams -> Int
$chash :: ExecuteCommandParams -> Int
hashWithSalt :: Int -> ExecuteCommandParams -> Int
$chashWithSalt :: Int -> ExecuteCommandParams -> Int
Hashable)
  deriving forall ann. [ExecuteCommandParams] -> Doc ann
forall ann. ExecuteCommandParams -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [ExecuteCommandParams] -> Doc ann
$cprettyList :: forall ann. [ExecuteCommandParams] -> Doc ann
pretty :: forall ann. ExecuteCommandParams -> Doc ann
$cpretty :: forall ann. ExecuteCommandParams -> Doc ann
Pretty via (ViaJSON ExecuteCommandParams)

instance Aeson.ToJSON ExecuteCommandParams where
  toJSON :: ExecuteCommandParams -> Value
toJSON (ExecuteCommandParams Maybe ProgressToken
arg0 Text
arg1 Maybe [Value]
arg2) = [Pair] -> Value
Aeson.object forall a b. (a -> b) -> a -> b
$ forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat forall a b. (a -> b) -> a -> b
$  [String
"workDoneToken" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe ProgressToken
arg0
    ,[Key
"command" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Text
arg1]
    ,String
"arguments" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe [Value]
arg2]

instance Aeson.FromJSON ExecuteCommandParams where
  parseJSON :: Value -> Parser ExecuteCommandParams
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"ExecuteCommandParams" forall a b. (a -> b) -> a -> b
$ \Object
arg -> Maybe ProgressToken
-> Text -> Maybe [Value] -> ExecuteCommandParams
ExecuteCommandParams forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Aeson..:! Key
"workDoneToken" forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"command" forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
arg forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Aeson..:! Key
"arguments"