-- 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.ChangeAnnotation 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 Data.Text
import qualified Language.LSP.Protocol.Types.Common

{-|
Additional information that describes document changes.

@since 3.16.0
-}
data ChangeAnnotation = ChangeAnnotation 
  { {-|
  A human-readable string describing the actual change. The string
  is rendered prominent in the user interface.
  -}
  ChangeAnnotation -> Text
_label :: Data.Text.Text
  , {-|
  A flag which indicates that user confirmation is needed
  before applying the change.
  -}
  ChangeAnnotation -> Maybe Bool
_needsConfirmation :: (Maybe Bool)
  , {-|
  A human-readable string which is rendered less prominent in
  the user interface.
  -}
  ChangeAnnotation -> Maybe Text
_description :: (Maybe Data.Text.Text)
  }
  deriving stock (Int -> ChangeAnnotation -> ShowS
[ChangeAnnotation] -> ShowS
ChangeAnnotation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChangeAnnotation] -> ShowS
$cshowList :: [ChangeAnnotation] -> ShowS
show :: ChangeAnnotation -> String
$cshow :: ChangeAnnotation -> String
showsPrec :: Int -> ChangeAnnotation -> ShowS
$cshowsPrec :: Int -> ChangeAnnotation -> ShowS
Show, ChangeAnnotation -> ChangeAnnotation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChangeAnnotation -> ChangeAnnotation -> Bool
$c/= :: ChangeAnnotation -> ChangeAnnotation -> Bool
== :: ChangeAnnotation -> ChangeAnnotation -> Bool
$c== :: ChangeAnnotation -> ChangeAnnotation -> Bool
Eq, Eq ChangeAnnotation
ChangeAnnotation -> ChangeAnnotation -> Bool
ChangeAnnotation -> ChangeAnnotation -> Ordering
ChangeAnnotation -> ChangeAnnotation -> ChangeAnnotation
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 :: ChangeAnnotation -> ChangeAnnotation -> ChangeAnnotation
$cmin :: ChangeAnnotation -> ChangeAnnotation -> ChangeAnnotation
max :: ChangeAnnotation -> ChangeAnnotation -> ChangeAnnotation
$cmax :: ChangeAnnotation -> ChangeAnnotation -> ChangeAnnotation
>= :: ChangeAnnotation -> ChangeAnnotation -> Bool
$c>= :: ChangeAnnotation -> ChangeAnnotation -> Bool
> :: ChangeAnnotation -> ChangeAnnotation -> Bool
$c> :: ChangeAnnotation -> ChangeAnnotation -> Bool
<= :: ChangeAnnotation -> ChangeAnnotation -> Bool
$c<= :: ChangeAnnotation -> ChangeAnnotation -> Bool
< :: ChangeAnnotation -> ChangeAnnotation -> Bool
$c< :: ChangeAnnotation -> ChangeAnnotation -> Bool
compare :: ChangeAnnotation -> ChangeAnnotation -> Ordering
$ccompare :: ChangeAnnotation -> ChangeAnnotation -> Ordering
Ord, forall x. Rep ChangeAnnotation x -> ChangeAnnotation
forall x. ChangeAnnotation -> Rep ChangeAnnotation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ChangeAnnotation x -> ChangeAnnotation
$cfrom :: forall x. ChangeAnnotation -> Rep ChangeAnnotation x
Generic)
  deriving anyclass (ChangeAnnotation -> ()
forall a. (a -> ()) -> NFData a
rnf :: ChangeAnnotation -> ()
$crnf :: ChangeAnnotation -> ()
NFData, Eq ChangeAnnotation
Int -> ChangeAnnotation -> Int
ChangeAnnotation -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: ChangeAnnotation -> Int
$chash :: ChangeAnnotation -> Int
hashWithSalt :: Int -> ChangeAnnotation -> Int
$chashWithSalt :: Int -> ChangeAnnotation -> Int
Hashable)

instance Aeson.ToJSON ChangeAnnotation where
  toJSON :: ChangeAnnotation -> Value
toJSON (ChangeAnnotation Text
arg0 Maybe Bool
arg1 Maybe Text
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
"label" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Text
arg0]
    ,String
"needsConfirmation" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Bool
arg1
    ,String
"description" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Text
arg2]

instance Aeson.FromJSON ChangeAnnotation where
  parseJSON :: Value -> Parser ChangeAnnotation
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"ChangeAnnotation" forall a b. (a -> b) -> a -> b
$ \Object
arg -> Text -> Maybe Bool -> Maybe Text -> ChangeAnnotation
ChangeAnnotation forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"label" 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
"needsConfirmation" 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
"description"