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

{-|
A special text edit with an additional change annotation.

@since 3.16.0.
-}
data AnnotatedTextEdit = AnnotatedTextEdit 
  { {-|
  The range of the text document to be manipulated. To insert
  text into a document create a range where start === end.
  -}
  AnnotatedTextEdit -> Range
_range :: Language.LSP.Protocol.Internal.Types.Range.Range
  , {-|
  The string to be inserted. For delete operations use an
  empty string.
  -}
  AnnotatedTextEdit -> Text
_newText :: Data.Text.Text
  , {-|
  The actual identifier of the change annotation
  -}
  AnnotatedTextEdit -> ChangeAnnotationIdentifier
_annotationId :: Language.LSP.Protocol.Internal.Types.ChangeAnnotationIdentifier.ChangeAnnotationIdentifier
  }
  deriving stock (Int -> AnnotatedTextEdit -> ShowS
[AnnotatedTextEdit] -> ShowS
AnnotatedTextEdit -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AnnotatedTextEdit] -> ShowS
$cshowList :: [AnnotatedTextEdit] -> ShowS
show :: AnnotatedTextEdit -> String
$cshow :: AnnotatedTextEdit -> String
showsPrec :: Int -> AnnotatedTextEdit -> ShowS
$cshowsPrec :: Int -> AnnotatedTextEdit -> ShowS
Show, AnnotatedTextEdit -> AnnotatedTextEdit -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AnnotatedTextEdit -> AnnotatedTextEdit -> Bool
$c/= :: AnnotatedTextEdit -> AnnotatedTextEdit -> Bool
== :: AnnotatedTextEdit -> AnnotatedTextEdit -> Bool
$c== :: AnnotatedTextEdit -> AnnotatedTextEdit -> Bool
Eq, Eq AnnotatedTextEdit
AnnotatedTextEdit -> AnnotatedTextEdit -> Bool
AnnotatedTextEdit -> AnnotatedTextEdit -> Ordering
AnnotatedTextEdit -> AnnotatedTextEdit -> AnnotatedTextEdit
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 :: AnnotatedTextEdit -> AnnotatedTextEdit -> AnnotatedTextEdit
$cmin :: AnnotatedTextEdit -> AnnotatedTextEdit -> AnnotatedTextEdit
max :: AnnotatedTextEdit -> AnnotatedTextEdit -> AnnotatedTextEdit
$cmax :: AnnotatedTextEdit -> AnnotatedTextEdit -> AnnotatedTextEdit
>= :: AnnotatedTextEdit -> AnnotatedTextEdit -> Bool
$c>= :: AnnotatedTextEdit -> AnnotatedTextEdit -> Bool
> :: AnnotatedTextEdit -> AnnotatedTextEdit -> Bool
$c> :: AnnotatedTextEdit -> AnnotatedTextEdit -> Bool
<= :: AnnotatedTextEdit -> AnnotatedTextEdit -> Bool
$c<= :: AnnotatedTextEdit -> AnnotatedTextEdit -> Bool
< :: AnnotatedTextEdit -> AnnotatedTextEdit -> Bool
$c< :: AnnotatedTextEdit -> AnnotatedTextEdit -> Bool
compare :: AnnotatedTextEdit -> AnnotatedTextEdit -> Ordering
$ccompare :: AnnotatedTextEdit -> AnnotatedTextEdit -> Ordering
Ord, forall x. Rep AnnotatedTextEdit x -> AnnotatedTextEdit
forall x. AnnotatedTextEdit -> Rep AnnotatedTextEdit x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AnnotatedTextEdit x -> AnnotatedTextEdit
$cfrom :: forall x. AnnotatedTextEdit -> Rep AnnotatedTextEdit x
Generic)
  deriving anyclass (AnnotatedTextEdit -> ()
forall a. (a -> ()) -> NFData a
rnf :: AnnotatedTextEdit -> ()
$crnf :: AnnotatedTextEdit -> ()
NFData, Eq AnnotatedTextEdit
Int -> AnnotatedTextEdit -> Int
AnnotatedTextEdit -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: AnnotatedTextEdit -> Int
$chash :: AnnotatedTextEdit -> Int
hashWithSalt :: Int -> AnnotatedTextEdit -> Int
$chashWithSalt :: Int -> AnnotatedTextEdit -> Int
Hashable)
  deriving forall ann. [AnnotatedTextEdit] -> Doc ann
forall ann. AnnotatedTextEdit -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [AnnotatedTextEdit] -> Doc ann
$cprettyList :: forall ann. [AnnotatedTextEdit] -> Doc ann
pretty :: forall ann. AnnotatedTextEdit -> Doc ann
$cpretty :: forall ann. AnnotatedTextEdit -> Doc ann
Pretty via (ViaJSON AnnotatedTextEdit)

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

instance Aeson.FromJSON AnnotatedTextEdit where
  parseJSON :: Value -> Parser AnnotatedTextEdit
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"AnnotatedTextEdit" forall a b. (a -> b) -> a -> b
$ \Object
arg -> Range -> Text -> ChangeAnnotationIdentifier -> AnnotatedTextEdit
AnnotatedTextEdit 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 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
"annotationId"