{- 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.CodeActionParams where

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

{-|
The parameters of a `CodeActionRequest`.
-}
data CodeActionParams = CodeActionParams 
  { {-|
  An optional token that a server can use to report work done progress.
  -}
  CodeActionParams -> Maybe ProgressToken
_workDoneToken :: (Maybe Language.LSP.Protocol.Internal.Types.ProgressToken.ProgressToken)
  , {-|
  An optional token that a server can use to report partial results (e.g. streaming) to
  the client.
  -}
  CodeActionParams -> Maybe ProgressToken
_partialResultToken :: (Maybe Language.LSP.Protocol.Internal.Types.ProgressToken.ProgressToken)
  , {-|
  The document in which the command was invoked.
  -}
  CodeActionParams -> TextDocumentIdentifier
_textDocument :: Language.LSP.Protocol.Internal.Types.TextDocumentIdentifier.TextDocumentIdentifier
  , {-|
  The range for which the command was invoked.
  -}
  CodeActionParams -> Range
_range :: Language.LSP.Protocol.Internal.Types.Range.Range
  , {-|
  Context carrying additional information.
  -}
  CodeActionParams -> CodeActionContext
_context :: Language.LSP.Protocol.Internal.Types.CodeActionContext.CodeActionContext
  }
  deriving stock (Int -> CodeActionParams -> ShowS
[CodeActionParams] -> ShowS
CodeActionParams -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CodeActionParams] -> ShowS
$cshowList :: [CodeActionParams] -> ShowS
show :: CodeActionParams -> String
$cshow :: CodeActionParams -> String
showsPrec :: Int -> CodeActionParams -> ShowS
$cshowsPrec :: Int -> CodeActionParams -> ShowS
Show, CodeActionParams -> CodeActionParams -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CodeActionParams -> CodeActionParams -> Bool
$c/= :: CodeActionParams -> CodeActionParams -> Bool
== :: CodeActionParams -> CodeActionParams -> Bool
$c== :: CodeActionParams -> CodeActionParams -> Bool
Eq, Eq CodeActionParams
CodeActionParams -> CodeActionParams -> Bool
CodeActionParams -> CodeActionParams -> Ordering
CodeActionParams -> CodeActionParams -> CodeActionParams
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 :: CodeActionParams -> CodeActionParams -> CodeActionParams
$cmin :: CodeActionParams -> CodeActionParams -> CodeActionParams
max :: CodeActionParams -> CodeActionParams -> CodeActionParams
$cmax :: CodeActionParams -> CodeActionParams -> CodeActionParams
>= :: CodeActionParams -> CodeActionParams -> Bool
$c>= :: CodeActionParams -> CodeActionParams -> Bool
> :: CodeActionParams -> CodeActionParams -> Bool
$c> :: CodeActionParams -> CodeActionParams -> Bool
<= :: CodeActionParams -> CodeActionParams -> Bool
$c<= :: CodeActionParams -> CodeActionParams -> Bool
< :: CodeActionParams -> CodeActionParams -> Bool
$c< :: CodeActionParams -> CodeActionParams -> Bool
compare :: CodeActionParams -> CodeActionParams -> Ordering
$ccompare :: CodeActionParams -> CodeActionParams -> Ordering
Ord, forall x. Rep CodeActionParams x -> CodeActionParams
forall x. CodeActionParams -> Rep CodeActionParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CodeActionParams x -> CodeActionParams
$cfrom :: forall x. CodeActionParams -> Rep CodeActionParams x
Generic)
  deriving anyclass (CodeActionParams -> ()
forall a. (a -> ()) -> NFData a
rnf :: CodeActionParams -> ()
$crnf :: CodeActionParams -> ()
NFData, Eq CodeActionParams
Int -> CodeActionParams -> Int
CodeActionParams -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: CodeActionParams -> Int
$chash :: CodeActionParams -> Int
hashWithSalt :: Int -> CodeActionParams -> Int
$chashWithSalt :: Int -> CodeActionParams -> Int
Hashable)
  deriving forall ann. [CodeActionParams] -> Doc ann
forall ann. CodeActionParams -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [CodeActionParams] -> Doc ann
$cprettyList :: forall ann. [CodeActionParams] -> Doc ann
pretty :: forall ann. CodeActionParams -> Doc ann
$cpretty :: forall ann. CodeActionParams -> Doc ann
Pretty via (ViaJSON CodeActionParams)

instance Aeson.ToJSON CodeActionParams where
  toJSON :: CodeActionParams -> Value
toJSON (CodeActionParams Maybe ProgressToken
arg0 Maybe ProgressToken
arg1 TextDocumentIdentifier
arg2 Range
arg3 CodeActionContext
arg4) = [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
    ,String
"partialResultToken" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe ProgressToken
arg1
    ,[Key
"textDocument" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= TextDocumentIdentifier
arg2]
    ,[Key
"range" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Range
arg3]
    ,[Key
"context" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= CodeActionContext
arg4]]

instance Aeson.FromJSON CodeActionParams where
  parseJSON :: Value -> Parser CodeActionParams
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"CodeActionParams" forall a b. (a -> b) -> a -> b
$ \Object
arg -> Maybe ProgressToken
-> Maybe ProgressToken
-> TextDocumentIdentifier
-> Range
-> CodeActionContext
-> CodeActionParams
CodeActionParams 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 (Maybe a)
Aeson..:! Key
"partialResultToken" 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
"textDocument" 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
"range" 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
"context"