{- 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.EditRangeWithInsertReplace 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.Range
import qualified Language.LSP.Protocol.Types.Common

{-|
Edit range variant that includes ranges for insert and replace operations.

@since 3.18.0
@proposed
-}
data EditRangeWithInsertReplace = EditRangeWithInsertReplace 
  { {-|

  -}
  EditRangeWithInsertReplace -> Range
_insert :: Language.LSP.Protocol.Internal.Types.Range.Range
  , {-|

  -}
  EditRangeWithInsertReplace -> Range
_replace :: Language.LSP.Protocol.Internal.Types.Range.Range
  }
  deriving stock (Int -> EditRangeWithInsertReplace -> ShowS
[EditRangeWithInsertReplace] -> ShowS
EditRangeWithInsertReplace -> String
(Int -> EditRangeWithInsertReplace -> ShowS)
-> (EditRangeWithInsertReplace -> String)
-> ([EditRangeWithInsertReplace] -> ShowS)
-> Show EditRangeWithInsertReplace
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> EditRangeWithInsertReplace -> ShowS
showsPrec :: Int -> EditRangeWithInsertReplace -> ShowS
$cshow :: EditRangeWithInsertReplace -> String
show :: EditRangeWithInsertReplace -> String
$cshowList :: [EditRangeWithInsertReplace] -> ShowS
showList :: [EditRangeWithInsertReplace] -> ShowS
Show, EditRangeWithInsertReplace -> EditRangeWithInsertReplace -> Bool
(EditRangeWithInsertReplace -> EditRangeWithInsertReplace -> Bool)
-> (EditRangeWithInsertReplace
    -> EditRangeWithInsertReplace -> Bool)
-> Eq EditRangeWithInsertReplace
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: EditRangeWithInsertReplace -> EditRangeWithInsertReplace -> Bool
== :: EditRangeWithInsertReplace -> EditRangeWithInsertReplace -> Bool
$c/= :: EditRangeWithInsertReplace -> EditRangeWithInsertReplace -> Bool
/= :: EditRangeWithInsertReplace -> EditRangeWithInsertReplace -> Bool
Eq, Eq EditRangeWithInsertReplace
Eq EditRangeWithInsertReplace =>
(EditRangeWithInsertReplace
 -> EditRangeWithInsertReplace -> Ordering)
-> (EditRangeWithInsertReplace
    -> EditRangeWithInsertReplace -> Bool)
-> (EditRangeWithInsertReplace
    -> EditRangeWithInsertReplace -> Bool)
-> (EditRangeWithInsertReplace
    -> EditRangeWithInsertReplace -> Bool)
-> (EditRangeWithInsertReplace
    -> EditRangeWithInsertReplace -> Bool)
-> (EditRangeWithInsertReplace
    -> EditRangeWithInsertReplace -> EditRangeWithInsertReplace)
-> (EditRangeWithInsertReplace
    -> EditRangeWithInsertReplace -> EditRangeWithInsertReplace)
-> Ord EditRangeWithInsertReplace
EditRangeWithInsertReplace -> EditRangeWithInsertReplace -> Bool
EditRangeWithInsertReplace
-> EditRangeWithInsertReplace -> Ordering
EditRangeWithInsertReplace
-> EditRangeWithInsertReplace -> EditRangeWithInsertReplace
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 :: EditRangeWithInsertReplace
-> EditRangeWithInsertReplace -> Ordering
compare :: EditRangeWithInsertReplace
-> EditRangeWithInsertReplace -> Ordering
$c< :: EditRangeWithInsertReplace -> EditRangeWithInsertReplace -> Bool
< :: EditRangeWithInsertReplace -> EditRangeWithInsertReplace -> Bool
$c<= :: EditRangeWithInsertReplace -> EditRangeWithInsertReplace -> Bool
<= :: EditRangeWithInsertReplace -> EditRangeWithInsertReplace -> Bool
$c> :: EditRangeWithInsertReplace -> EditRangeWithInsertReplace -> Bool
> :: EditRangeWithInsertReplace -> EditRangeWithInsertReplace -> Bool
$c>= :: EditRangeWithInsertReplace -> EditRangeWithInsertReplace -> Bool
>= :: EditRangeWithInsertReplace -> EditRangeWithInsertReplace -> Bool
$cmax :: EditRangeWithInsertReplace
-> EditRangeWithInsertReplace -> EditRangeWithInsertReplace
max :: EditRangeWithInsertReplace
-> EditRangeWithInsertReplace -> EditRangeWithInsertReplace
$cmin :: EditRangeWithInsertReplace
-> EditRangeWithInsertReplace -> EditRangeWithInsertReplace
min :: EditRangeWithInsertReplace
-> EditRangeWithInsertReplace -> EditRangeWithInsertReplace
Ord, (forall x.
 EditRangeWithInsertReplace -> Rep EditRangeWithInsertReplace x)
-> (forall x.
    Rep EditRangeWithInsertReplace x -> EditRangeWithInsertReplace)
-> Generic EditRangeWithInsertReplace
forall x.
Rep EditRangeWithInsertReplace x -> EditRangeWithInsertReplace
forall x.
EditRangeWithInsertReplace -> Rep EditRangeWithInsertReplace x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x.
EditRangeWithInsertReplace -> Rep EditRangeWithInsertReplace x
from :: forall x.
EditRangeWithInsertReplace -> Rep EditRangeWithInsertReplace x
$cto :: forall x.
Rep EditRangeWithInsertReplace x -> EditRangeWithInsertReplace
to :: forall x.
Rep EditRangeWithInsertReplace x -> EditRangeWithInsertReplace
Generic)
  deriving anyclass (EditRangeWithInsertReplace -> ()
(EditRangeWithInsertReplace -> ())
-> NFData EditRangeWithInsertReplace
forall a. (a -> ()) -> NFData a
$crnf :: EditRangeWithInsertReplace -> ()
rnf :: EditRangeWithInsertReplace -> ()
NFData, Eq EditRangeWithInsertReplace
Eq EditRangeWithInsertReplace =>
(Int -> EditRangeWithInsertReplace -> Int)
-> (EditRangeWithInsertReplace -> Int)
-> Hashable EditRangeWithInsertReplace
Int -> EditRangeWithInsertReplace -> Int
EditRangeWithInsertReplace -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> EditRangeWithInsertReplace -> Int
hashWithSalt :: Int -> EditRangeWithInsertReplace -> Int
$chash :: EditRangeWithInsertReplace -> Int
hash :: EditRangeWithInsertReplace -> Int
Hashable)
  deriving (forall ann. EditRangeWithInsertReplace -> Doc ann)
-> (forall ann. [EditRangeWithInsertReplace] -> Doc ann)
-> Pretty EditRangeWithInsertReplace
forall ann. [EditRangeWithInsertReplace] -> Doc ann
forall ann. EditRangeWithInsertReplace -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
$cpretty :: forall ann. EditRangeWithInsertReplace -> Doc ann
pretty :: forall ann. EditRangeWithInsertReplace -> Doc ann
$cprettyList :: forall ann. [EditRangeWithInsertReplace] -> Doc ann
prettyList :: forall ann. [EditRangeWithInsertReplace] -> Doc ann
Pretty via (ViaJSON EditRangeWithInsertReplace)

instance Aeson.ToJSON EditRangeWithInsertReplace where
  toJSON :: EditRangeWithInsertReplace -> Value
toJSON (EditRangeWithInsertReplace Range
arg0 Range
arg1) = [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
"insert" Key -> Range -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= Range
arg0]
    ,[Key
"replace" Key -> Range -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= Range
arg1]]

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