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

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

instance Aeson.ToJSON HoverParams where
  toJSON :: HoverParams -> Value
toJSON (HoverParams TextDocumentIdentifier
arg0 Position
arg1 Maybe ProgressToken
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
$  [[Key
"textDocument" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= TextDocumentIdentifier
arg0]
    ,[Key
"position" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Position
arg1]
    ,String
"workDoneToken" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe ProgressToken
arg2]

instance Aeson.FromJSON HoverParams where
  parseJSON :: Value -> Parser HoverParams
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"HoverParams" forall a b. (a -> b) -> a -> b
$ \Object
arg -> TextDocumentIdentifier
-> Position -> Maybe ProgressToken -> HoverParams
HoverParams forall (f :: * -> *) a b. Functor 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
"position" 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
"workDoneToken"