{- 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.CodeLensParams 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.ProgressToken
import qualified Language.LSP.Protocol.Internal.Types.TextDocumentIdentifier
import qualified Language.LSP.Protocol.Types.Common

{-|
The parameters of a `CodeLensRequest`.
-}
data CodeLensParams = CodeLensParams 
  { {-|
  An optional token that a server can use to report work done progress.
  -}
  CodeLensParams -> 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.
  -}
  CodeLensParams -> Maybe ProgressToken
_partialResultToken :: (Maybe Language.LSP.Protocol.Internal.Types.ProgressToken.ProgressToken)
  , {-|
  The document to request code lens for.
  -}
  CodeLensParams -> TextDocumentIdentifier
_textDocument :: Language.LSP.Protocol.Internal.Types.TextDocumentIdentifier.TextDocumentIdentifier
  }
  deriving stock (Int -> CodeLensParams -> ShowS
[CodeLensParams] -> ShowS
CodeLensParams -> String
(Int -> CodeLensParams -> ShowS)
-> (CodeLensParams -> String)
-> ([CodeLensParams] -> ShowS)
-> Show CodeLensParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CodeLensParams -> ShowS
showsPrec :: Int -> CodeLensParams -> ShowS
$cshow :: CodeLensParams -> String
show :: CodeLensParams -> String
$cshowList :: [CodeLensParams] -> ShowS
showList :: [CodeLensParams] -> ShowS
Show, CodeLensParams -> CodeLensParams -> Bool
(CodeLensParams -> CodeLensParams -> Bool)
-> (CodeLensParams -> CodeLensParams -> Bool) -> Eq CodeLensParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CodeLensParams -> CodeLensParams -> Bool
== :: CodeLensParams -> CodeLensParams -> Bool
$c/= :: CodeLensParams -> CodeLensParams -> Bool
/= :: CodeLensParams -> CodeLensParams -> Bool
Eq, Eq CodeLensParams
Eq CodeLensParams =>
(CodeLensParams -> CodeLensParams -> Ordering)
-> (CodeLensParams -> CodeLensParams -> Bool)
-> (CodeLensParams -> CodeLensParams -> Bool)
-> (CodeLensParams -> CodeLensParams -> Bool)
-> (CodeLensParams -> CodeLensParams -> Bool)
-> (CodeLensParams -> CodeLensParams -> CodeLensParams)
-> (CodeLensParams -> CodeLensParams -> CodeLensParams)
-> Ord CodeLensParams
CodeLensParams -> CodeLensParams -> Bool
CodeLensParams -> CodeLensParams -> Ordering
CodeLensParams -> CodeLensParams -> CodeLensParams
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
$ccompare :: CodeLensParams -> CodeLensParams -> Ordering
compare :: CodeLensParams -> CodeLensParams -> Ordering
$c< :: CodeLensParams -> CodeLensParams -> Bool
< :: CodeLensParams -> CodeLensParams -> Bool
$c<= :: CodeLensParams -> CodeLensParams -> Bool
<= :: CodeLensParams -> CodeLensParams -> Bool
$c> :: CodeLensParams -> CodeLensParams -> Bool
> :: CodeLensParams -> CodeLensParams -> Bool
$c>= :: CodeLensParams -> CodeLensParams -> Bool
>= :: CodeLensParams -> CodeLensParams -> Bool
$cmax :: CodeLensParams -> CodeLensParams -> CodeLensParams
max :: CodeLensParams -> CodeLensParams -> CodeLensParams
$cmin :: CodeLensParams -> CodeLensParams -> CodeLensParams
min :: CodeLensParams -> CodeLensParams -> CodeLensParams
Ord, (forall x. CodeLensParams -> Rep CodeLensParams x)
-> (forall x. Rep CodeLensParams x -> CodeLensParams)
-> Generic CodeLensParams
forall x. Rep CodeLensParams x -> CodeLensParams
forall x. CodeLensParams -> Rep CodeLensParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CodeLensParams -> Rep CodeLensParams x
from :: forall x. CodeLensParams -> Rep CodeLensParams x
$cto :: forall x. Rep CodeLensParams x -> CodeLensParams
to :: forall x. Rep CodeLensParams x -> CodeLensParams
Generic)
  deriving anyclass (CodeLensParams -> ()
(CodeLensParams -> ()) -> NFData CodeLensParams
forall a. (a -> ()) -> NFData a
$crnf :: CodeLensParams -> ()
rnf :: CodeLensParams -> ()
NFData, Eq CodeLensParams
Eq CodeLensParams =>
(Int -> CodeLensParams -> Int)
-> (CodeLensParams -> Int) -> Hashable CodeLensParams
Int -> CodeLensParams -> Int
CodeLensParams -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> CodeLensParams -> Int
hashWithSalt :: Int -> CodeLensParams -> Int
$chash :: CodeLensParams -> Int
hash :: CodeLensParams -> Int
Hashable)
  deriving (forall ann. CodeLensParams -> Doc ann)
-> (forall ann. [CodeLensParams] -> Doc ann)
-> Pretty CodeLensParams
forall ann. [CodeLensParams] -> Doc ann
forall ann. CodeLensParams -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
$cpretty :: forall ann. CodeLensParams -> Doc ann
pretty :: forall ann. CodeLensParams -> Doc ann
$cprettyList :: forall ann. [CodeLensParams] -> Doc ann
prettyList :: forall ann. [CodeLensParams] -> Doc ann
Pretty via (ViaJSON CodeLensParams)

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

instance Aeson.FromJSON CodeLensParams where
  parseJSON :: Value -> Parser CodeLensParams
parseJSON = String
-> (Object -> Parser CodeLensParams)
-> Value
-> Parser CodeLensParams
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"CodeLensParams" ((Object -> Parser CodeLensParams)
 -> Value -> Parser CodeLensParams)
-> (Object -> Parser CodeLensParams)
-> Value
-> Parser CodeLensParams
forall a b. (a -> b) -> a -> b
$ \Object
arg -> Maybe ProgressToken
-> Maybe ProgressToken -> TextDocumentIdentifier -> CodeLensParams
CodeLensParams (Maybe ProgressToken
 -> Maybe ProgressToken -> TextDocumentIdentifier -> CodeLensParams)
-> Parser (Maybe ProgressToken)
-> Parser
     (Maybe ProgressToken -> TextDocumentIdentifier -> CodeLensParams)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg Object -> Key -> Parser (Maybe ProgressToken)
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"workDoneToken" Parser
  (Maybe ProgressToken -> TextDocumentIdentifier -> CodeLensParams)
-> Parser (Maybe ProgressToken)
-> Parser (TextDocumentIdentifier -> CodeLensParams)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
arg Object -> Key -> Parser (Maybe ProgressToken)
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"partialResultToken" Parser (TextDocumentIdentifier -> CodeLensParams)
-> Parser TextDocumentIdentifier -> Parser CodeLensParams
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
arg Object -> Key -> Parser TextDocumentIdentifier
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"textDocument"