{- 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.SelectionRangeParams 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

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

instance Aeson.ToJSON SelectionRangeParams where
  toJSON :: SelectionRangeParams -> Value
toJSON (SelectionRangeParams Maybe ProgressToken
arg0 Maybe ProgressToken
arg1 TextDocumentIdentifier
arg2 [Position]
arg3) = [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]
    ,[Key
"positions" Key -> [Position] -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= [Position]
arg3]]

instance Aeson.FromJSON SelectionRangeParams where
  parseJSON :: Value -> Parser SelectionRangeParams
parseJSON = String
-> (Object -> Parser SelectionRangeParams)
-> Value
-> Parser SelectionRangeParams
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"SelectionRangeParams" ((Object -> Parser SelectionRangeParams)
 -> Value -> Parser SelectionRangeParams)
-> (Object -> Parser SelectionRangeParams)
-> Value
-> Parser SelectionRangeParams
forall a b. (a -> b) -> a -> b
$ \Object
arg -> Maybe ProgressToken
-> Maybe ProgressToken
-> TextDocumentIdentifier
-> [Position]
-> SelectionRangeParams
SelectionRangeParams (Maybe ProgressToken
 -> Maybe ProgressToken
 -> TextDocumentIdentifier
 -> [Position]
 -> SelectionRangeParams)
-> Parser (Maybe ProgressToken)
-> Parser
     (Maybe ProgressToken
      -> TextDocumentIdentifier -> [Position] -> SelectionRangeParams)
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 -> [Position] -> SelectionRangeParams)
-> Parser (Maybe ProgressToken)
-> Parser
     (TextDocumentIdentifier -> [Position] -> SelectionRangeParams)
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 -> [Position] -> SelectionRangeParams)
-> Parser TextDocumentIdentifier
-> Parser ([Position] -> SelectionRangeParams)
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" Parser ([Position] -> SelectionRangeParams)
-> Parser [Position] -> Parser SelectionRangeParams
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
"positions"