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

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