{- 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.InsertReplaceEdit 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 Data.Text
import qualified Language.LSP.Protocol.Internal.Types.Range
import qualified Language.LSP.Protocol.Types.Common

{-|
A special text edit to provide an insert and a replace operation.

@since 3.16.0
-}
data InsertReplaceEdit = InsertReplaceEdit 
  { {-|
  The string to be inserted.
  -}
  InsertReplaceEdit -> Text
_newText :: Data.Text.Text
  , {-|
  The range if the insert is requested
  -}
  InsertReplaceEdit -> Range
_insert :: Language.LSP.Protocol.Internal.Types.Range.Range
  , {-|
  The range if the replace is requested.
  -}
  InsertReplaceEdit -> Range
_replace :: Language.LSP.Protocol.Internal.Types.Range.Range
  }
  deriving stock (Int -> InsertReplaceEdit -> ShowS
[InsertReplaceEdit] -> ShowS
InsertReplaceEdit -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InsertReplaceEdit] -> ShowS
$cshowList :: [InsertReplaceEdit] -> ShowS
show :: InsertReplaceEdit -> String
$cshow :: InsertReplaceEdit -> String
showsPrec :: Int -> InsertReplaceEdit -> ShowS
$cshowsPrec :: Int -> InsertReplaceEdit -> ShowS
Show, InsertReplaceEdit -> InsertReplaceEdit -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InsertReplaceEdit -> InsertReplaceEdit -> Bool
$c/= :: InsertReplaceEdit -> InsertReplaceEdit -> Bool
== :: InsertReplaceEdit -> InsertReplaceEdit -> Bool
$c== :: InsertReplaceEdit -> InsertReplaceEdit -> Bool
Eq, Eq InsertReplaceEdit
InsertReplaceEdit -> InsertReplaceEdit -> Bool
InsertReplaceEdit -> InsertReplaceEdit -> Ordering
InsertReplaceEdit -> InsertReplaceEdit -> InsertReplaceEdit
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 :: InsertReplaceEdit -> InsertReplaceEdit -> InsertReplaceEdit
$cmin :: InsertReplaceEdit -> InsertReplaceEdit -> InsertReplaceEdit
max :: InsertReplaceEdit -> InsertReplaceEdit -> InsertReplaceEdit
$cmax :: InsertReplaceEdit -> InsertReplaceEdit -> InsertReplaceEdit
>= :: InsertReplaceEdit -> InsertReplaceEdit -> Bool
$c>= :: InsertReplaceEdit -> InsertReplaceEdit -> Bool
> :: InsertReplaceEdit -> InsertReplaceEdit -> Bool
$c> :: InsertReplaceEdit -> InsertReplaceEdit -> Bool
<= :: InsertReplaceEdit -> InsertReplaceEdit -> Bool
$c<= :: InsertReplaceEdit -> InsertReplaceEdit -> Bool
< :: InsertReplaceEdit -> InsertReplaceEdit -> Bool
$c< :: InsertReplaceEdit -> InsertReplaceEdit -> Bool
compare :: InsertReplaceEdit -> InsertReplaceEdit -> Ordering
$ccompare :: InsertReplaceEdit -> InsertReplaceEdit -> Ordering
Ord, forall x. Rep InsertReplaceEdit x -> InsertReplaceEdit
forall x. InsertReplaceEdit -> Rep InsertReplaceEdit x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InsertReplaceEdit x -> InsertReplaceEdit
$cfrom :: forall x. InsertReplaceEdit -> Rep InsertReplaceEdit x
Generic)
  deriving anyclass (InsertReplaceEdit -> ()
forall a. (a -> ()) -> NFData a
rnf :: InsertReplaceEdit -> ()
$crnf :: InsertReplaceEdit -> ()
NFData, Eq InsertReplaceEdit
Int -> InsertReplaceEdit -> Int
InsertReplaceEdit -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: InsertReplaceEdit -> Int
$chash :: InsertReplaceEdit -> Int
hashWithSalt :: Int -> InsertReplaceEdit -> Int
$chashWithSalt :: Int -> InsertReplaceEdit -> Int
Hashable)
  deriving forall ann. [InsertReplaceEdit] -> Doc ann
forall ann. InsertReplaceEdit -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [InsertReplaceEdit] -> Doc ann
$cprettyList :: forall ann. [InsertReplaceEdit] -> Doc ann
pretty :: forall ann. InsertReplaceEdit -> Doc ann
$cpretty :: forall ann. InsertReplaceEdit -> Doc ann
Pretty via (ViaJSON InsertReplaceEdit)

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

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