{- 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.ApplyWorkspaceEditResult 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

{-|
The result returned from the apply workspace edit request.

@since 3.17 renamed from ApplyWorkspaceEditResponse
-}
data ApplyWorkspaceEditResult = ApplyWorkspaceEditResult 
  { {-|
  Indicates whether the edit was applied or not.
  -}
  ApplyWorkspaceEditResult -> Bool
_applied :: Bool
  , {-|
  An optional textual description for why the edit was not applied.
  This may be used by the server for diagnostic logging or to provide
  a suitable error for a request that triggered the edit.
  -}
  ApplyWorkspaceEditResult -> Maybe Text
_failureReason :: (Maybe Data.Text.Text)
  , {-|
  Depending on the client's failure handling strategy `failedChange` might
  contain the index of the change that failed. This property is only available
  if the client signals a `failureHandlingStrategy` in its client capabilities.
  -}
  ApplyWorkspaceEditResult -> Maybe UInt
_failedChange :: (Maybe Language.LSP.Protocol.Types.Common.UInt)
  }
  deriving stock (Int -> ApplyWorkspaceEditResult -> ShowS
[ApplyWorkspaceEditResult] -> ShowS
ApplyWorkspaceEditResult -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ApplyWorkspaceEditResult] -> ShowS
$cshowList :: [ApplyWorkspaceEditResult] -> ShowS
show :: ApplyWorkspaceEditResult -> String
$cshow :: ApplyWorkspaceEditResult -> String
showsPrec :: Int -> ApplyWorkspaceEditResult -> ShowS
$cshowsPrec :: Int -> ApplyWorkspaceEditResult -> ShowS
Show, ApplyWorkspaceEditResult -> ApplyWorkspaceEditResult -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ApplyWorkspaceEditResult -> ApplyWorkspaceEditResult -> Bool
$c/= :: ApplyWorkspaceEditResult -> ApplyWorkspaceEditResult -> Bool
== :: ApplyWorkspaceEditResult -> ApplyWorkspaceEditResult -> Bool
$c== :: ApplyWorkspaceEditResult -> ApplyWorkspaceEditResult -> Bool
Eq, Eq ApplyWorkspaceEditResult
ApplyWorkspaceEditResult -> ApplyWorkspaceEditResult -> Bool
ApplyWorkspaceEditResult -> ApplyWorkspaceEditResult -> Ordering
ApplyWorkspaceEditResult
-> ApplyWorkspaceEditResult -> ApplyWorkspaceEditResult
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 :: ApplyWorkspaceEditResult
-> ApplyWorkspaceEditResult -> ApplyWorkspaceEditResult
$cmin :: ApplyWorkspaceEditResult
-> ApplyWorkspaceEditResult -> ApplyWorkspaceEditResult
max :: ApplyWorkspaceEditResult
-> ApplyWorkspaceEditResult -> ApplyWorkspaceEditResult
$cmax :: ApplyWorkspaceEditResult
-> ApplyWorkspaceEditResult -> ApplyWorkspaceEditResult
>= :: ApplyWorkspaceEditResult -> ApplyWorkspaceEditResult -> Bool
$c>= :: ApplyWorkspaceEditResult -> ApplyWorkspaceEditResult -> Bool
> :: ApplyWorkspaceEditResult -> ApplyWorkspaceEditResult -> Bool
$c> :: ApplyWorkspaceEditResult -> ApplyWorkspaceEditResult -> Bool
<= :: ApplyWorkspaceEditResult -> ApplyWorkspaceEditResult -> Bool
$c<= :: ApplyWorkspaceEditResult -> ApplyWorkspaceEditResult -> Bool
< :: ApplyWorkspaceEditResult -> ApplyWorkspaceEditResult -> Bool
$c< :: ApplyWorkspaceEditResult -> ApplyWorkspaceEditResult -> Bool
compare :: ApplyWorkspaceEditResult -> ApplyWorkspaceEditResult -> Ordering
$ccompare :: ApplyWorkspaceEditResult -> ApplyWorkspaceEditResult -> Ordering
Ord, forall x.
Rep ApplyWorkspaceEditResult x -> ApplyWorkspaceEditResult
forall x.
ApplyWorkspaceEditResult -> Rep ApplyWorkspaceEditResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ApplyWorkspaceEditResult x -> ApplyWorkspaceEditResult
$cfrom :: forall x.
ApplyWorkspaceEditResult -> Rep ApplyWorkspaceEditResult x
Generic)
  deriving anyclass (ApplyWorkspaceEditResult -> ()
forall a. (a -> ()) -> NFData a
rnf :: ApplyWorkspaceEditResult -> ()
$crnf :: ApplyWorkspaceEditResult -> ()
NFData, Eq ApplyWorkspaceEditResult
Int -> ApplyWorkspaceEditResult -> Int
ApplyWorkspaceEditResult -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: ApplyWorkspaceEditResult -> Int
$chash :: ApplyWorkspaceEditResult -> Int
hashWithSalt :: Int -> ApplyWorkspaceEditResult -> Int
$chashWithSalt :: Int -> ApplyWorkspaceEditResult -> Int
Hashable)
  deriving forall ann. [ApplyWorkspaceEditResult] -> Doc ann
forall ann. ApplyWorkspaceEditResult -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [ApplyWorkspaceEditResult] -> Doc ann
$cprettyList :: forall ann. [ApplyWorkspaceEditResult] -> Doc ann
pretty :: forall ann. ApplyWorkspaceEditResult -> Doc ann
$cpretty :: forall ann. ApplyWorkspaceEditResult -> Doc ann
Pretty via (ViaJSON ApplyWorkspaceEditResult)

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

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