-- 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.SelectionRange where

import Control.DeepSeq
import Data.Hashable
import GHC.Generics
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.Range
import qualified Language.LSP.Protocol.Types.Common

{-|
A selection range represents a part of a selection hierarchy. A selection range
may have a parent selection range that contains it.
-}
data SelectionRange = SelectionRange 
  { {-|
  The `Range` of this selection range.
  -}
  SelectionRange -> Range
_range :: Language.LSP.Protocol.Internal.Types.Range.Range
  , {-|
  The parent selection range containing this range. Therefore `parent.range` must contain `this.range`.
  -}
  SelectionRange -> Maybe SelectionRange
_parent :: (Maybe Language.LSP.Protocol.Internal.Types.SelectionRange.SelectionRange)
  }
  deriving stock (Int -> SelectionRange -> ShowS
[SelectionRange] -> ShowS
SelectionRange -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SelectionRange] -> ShowS
$cshowList :: [SelectionRange] -> ShowS
show :: SelectionRange -> String
$cshow :: SelectionRange -> String
showsPrec :: Int -> SelectionRange -> ShowS
$cshowsPrec :: Int -> SelectionRange -> ShowS
Show, SelectionRange -> SelectionRange -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SelectionRange -> SelectionRange -> Bool
$c/= :: SelectionRange -> SelectionRange -> Bool
== :: SelectionRange -> SelectionRange -> Bool
$c== :: SelectionRange -> SelectionRange -> Bool
Eq, Eq SelectionRange
SelectionRange -> SelectionRange -> Bool
SelectionRange -> SelectionRange -> Ordering
SelectionRange -> SelectionRange -> SelectionRange
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 :: SelectionRange -> SelectionRange -> SelectionRange
$cmin :: SelectionRange -> SelectionRange -> SelectionRange
max :: SelectionRange -> SelectionRange -> SelectionRange
$cmax :: SelectionRange -> SelectionRange -> SelectionRange
>= :: SelectionRange -> SelectionRange -> Bool
$c>= :: SelectionRange -> SelectionRange -> Bool
> :: SelectionRange -> SelectionRange -> Bool
$c> :: SelectionRange -> SelectionRange -> Bool
<= :: SelectionRange -> SelectionRange -> Bool
$c<= :: SelectionRange -> SelectionRange -> Bool
< :: SelectionRange -> SelectionRange -> Bool
$c< :: SelectionRange -> SelectionRange -> Bool
compare :: SelectionRange -> SelectionRange -> Ordering
$ccompare :: SelectionRange -> SelectionRange -> Ordering
Ord, forall x. Rep SelectionRange x -> SelectionRange
forall x. SelectionRange -> Rep SelectionRange x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SelectionRange x -> SelectionRange
$cfrom :: forall x. SelectionRange -> Rep SelectionRange x
Generic)
  deriving anyclass (SelectionRange -> ()
forall a. (a -> ()) -> NFData a
rnf :: SelectionRange -> ()
$crnf :: SelectionRange -> ()
NFData, Eq SelectionRange
Int -> SelectionRange -> Int
SelectionRange -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: SelectionRange -> Int
$chash :: SelectionRange -> Int
hashWithSalt :: Int -> SelectionRange -> Int
$chashWithSalt :: Int -> SelectionRange -> Int
Hashable)

instance Aeson.ToJSON SelectionRange where
  toJSON :: SelectionRange -> Value
toJSON (SelectionRange Range
arg0 Maybe SelectionRange
arg1) = [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
"range" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Range
arg0]
    ,String
"parent" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe SelectionRange
arg1]

instance Aeson.FromJSON SelectionRange where
  parseJSON :: Value -> Parser SelectionRange
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"SelectionRange" forall a b. (a -> b) -> a -> b
$ \Object
arg -> Range -> Maybe SelectionRange -> SelectionRange
SelectionRange forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"range" 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
"parent"