{- 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
(Int -> HoverParams -> ShowS)
-> (HoverParams -> String)
-> ([HoverParams] -> ShowS)
-> Show HoverParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> HoverParams -> ShowS
showsPrec :: Int -> HoverParams -> ShowS
$cshow :: HoverParams -> String
show :: HoverParams -> String
$cshowList :: [HoverParams] -> ShowS
showList :: [HoverParams] -> ShowS
Show, HoverParams -> HoverParams -> Bool
(HoverParams -> HoverParams -> Bool)
-> (HoverParams -> HoverParams -> Bool) -> Eq HoverParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: HoverParams -> HoverParams -> Bool
== :: HoverParams -> HoverParams -> Bool
$c/= :: HoverParams -> HoverParams -> Bool
/= :: HoverParams -> HoverParams -> Bool
Eq, Eq HoverParams
Eq HoverParams =>
(HoverParams -> HoverParams -> Ordering)
-> (HoverParams -> HoverParams -> Bool)
-> (HoverParams -> HoverParams -> Bool)
-> (HoverParams -> HoverParams -> Bool)
-> (HoverParams -> HoverParams -> Bool)
-> (HoverParams -> HoverParams -> HoverParams)
-> (HoverParams -> HoverParams -> HoverParams)
-> Ord 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
$ccompare :: HoverParams -> HoverParams -> Ordering
compare :: HoverParams -> HoverParams -> Ordering
$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
>= :: HoverParams -> HoverParams -> Bool
$cmax :: HoverParams -> HoverParams -> HoverParams
max :: HoverParams -> HoverParams -> HoverParams
$cmin :: HoverParams -> HoverParams -> HoverParams
min :: HoverParams -> HoverParams -> HoverParams
Ord, (forall x. HoverParams -> Rep HoverParams x)
-> (forall x. Rep HoverParams x -> HoverParams)
-> Generic HoverParams
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
$cfrom :: forall x. HoverParams -> Rep HoverParams x
from :: forall x. HoverParams -> Rep HoverParams x
$cto :: forall x. Rep HoverParams x -> HoverParams
to :: forall x. Rep HoverParams x -> HoverParams
Generic)
  deriving anyclass (HoverParams -> ()
(HoverParams -> ()) -> NFData HoverParams
forall a. (a -> ()) -> NFData a
$crnf :: HoverParams -> ()
rnf :: HoverParams -> ()
NFData, Eq HoverParams
Eq HoverParams =>
(Int -> HoverParams -> Int)
-> (HoverParams -> Int) -> Hashable HoverParams
Int -> HoverParams -> Int
HoverParams -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> HoverParams -> Int
hashWithSalt :: Int -> HoverParams -> Int
$chash :: HoverParams -> Int
hash :: HoverParams -> Int
Hashable)
  deriving (forall ann. HoverParams -> Doc ann)
-> (forall ann. [HoverParams] -> Doc ann) -> Pretty HoverParams
forall ann. [HoverParams] -> Doc ann
forall ann. HoverParams -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
$cpretty :: forall ann. HoverParams -> Doc ann
pretty :: forall ann. HoverParams -> Doc ann
$cprettyList :: forall ann. [HoverParams] -> Doc ann
prettyList :: 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 ([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
$  [[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
arg0]
    ,[Key
"position" Key -> Position -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= Position
arg1]
    ,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
arg2]

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