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

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