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

instance Aeson.ToJSON ChangeAnnotation where
  toJSON :: ChangeAnnotation -> Value
toJSON (ChangeAnnotation Text
arg0 Maybe Bool
arg1 Maybe Text
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
"label" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= Text
arg0]
    ,String
"needsConfirmation" String -> Maybe Bool -> [Pair]
forall e kv v.
(KeyValue e kv, ToJSON v) =>
String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Bool
arg1
    ,String
"description" String -> Maybe Text -> [Pair]
forall e kv v.
(KeyValue e 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 = String
-> (Object -> Parser ChangeAnnotation)
-> Value
-> Parser ChangeAnnotation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"ChangeAnnotation" ((Object -> Parser ChangeAnnotation)
 -> Value -> Parser ChangeAnnotation)
-> (Object -> Parser ChangeAnnotation)
-> Value
-> Parser ChangeAnnotation
forall a b. (a -> b) -> a -> b
$ \Object
arg -> Text -> Maybe Bool -> Maybe Text -> ChangeAnnotation
ChangeAnnotation (Text -> Maybe Bool -> Maybe Text -> ChangeAnnotation)
-> Parser Text
-> Parser (Maybe Bool -> Maybe Text -> ChangeAnnotation)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"label" Parser (Maybe Bool -> Maybe Text -> ChangeAnnotation)
-> Parser (Maybe Bool) -> Parser (Maybe Text -> ChangeAnnotation)
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 (Maybe Bool)
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"needsConfirmation" Parser (Maybe Text -> ChangeAnnotation)
-> Parser (Maybe Text) -> Parser ChangeAnnotation
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 (Maybe Text)
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"description"