{- 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.SemanticTokensDelta 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.SemanticTokensEdit
import qualified Language.LSP.Protocol.Types.Common

{-|
@since 3.16.0
-}
data SemanticTokensDelta = SemanticTokensDelta 
  { {-|

  -}
  SemanticTokensDelta -> Maybe Text
_resultId :: (Maybe Data.Text.Text)
  , {-|
  The semantic token edits to transform a previous result into a new result.
  -}
  SemanticTokensDelta -> [SemanticTokensEdit]
_edits :: [Language.LSP.Protocol.Internal.Types.SemanticTokensEdit.SemanticTokensEdit]
  }
  deriving stock (Int -> SemanticTokensDelta -> ShowS
[SemanticTokensDelta] -> ShowS
SemanticTokensDelta -> String
(Int -> SemanticTokensDelta -> ShowS)
-> (SemanticTokensDelta -> String)
-> ([SemanticTokensDelta] -> ShowS)
-> Show SemanticTokensDelta
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SemanticTokensDelta -> ShowS
showsPrec :: Int -> SemanticTokensDelta -> ShowS
$cshow :: SemanticTokensDelta -> String
show :: SemanticTokensDelta -> String
$cshowList :: [SemanticTokensDelta] -> ShowS
showList :: [SemanticTokensDelta] -> ShowS
Show, SemanticTokensDelta -> SemanticTokensDelta -> Bool
(SemanticTokensDelta -> SemanticTokensDelta -> Bool)
-> (SemanticTokensDelta -> SemanticTokensDelta -> Bool)
-> Eq SemanticTokensDelta
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SemanticTokensDelta -> SemanticTokensDelta -> Bool
== :: SemanticTokensDelta -> SemanticTokensDelta -> Bool
$c/= :: SemanticTokensDelta -> SemanticTokensDelta -> Bool
/= :: SemanticTokensDelta -> SemanticTokensDelta -> Bool
Eq, Eq SemanticTokensDelta
Eq SemanticTokensDelta =>
(SemanticTokensDelta -> SemanticTokensDelta -> Ordering)
-> (SemanticTokensDelta -> SemanticTokensDelta -> Bool)
-> (SemanticTokensDelta -> SemanticTokensDelta -> Bool)
-> (SemanticTokensDelta -> SemanticTokensDelta -> Bool)
-> (SemanticTokensDelta -> SemanticTokensDelta -> Bool)
-> (SemanticTokensDelta
    -> SemanticTokensDelta -> SemanticTokensDelta)
-> (SemanticTokensDelta
    -> SemanticTokensDelta -> SemanticTokensDelta)
-> Ord SemanticTokensDelta
SemanticTokensDelta -> SemanticTokensDelta -> Bool
SemanticTokensDelta -> SemanticTokensDelta -> Ordering
SemanticTokensDelta -> SemanticTokensDelta -> SemanticTokensDelta
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 :: SemanticTokensDelta -> SemanticTokensDelta -> Ordering
compare :: SemanticTokensDelta -> SemanticTokensDelta -> Ordering
$c< :: SemanticTokensDelta -> SemanticTokensDelta -> Bool
< :: SemanticTokensDelta -> SemanticTokensDelta -> Bool
$c<= :: SemanticTokensDelta -> SemanticTokensDelta -> Bool
<= :: SemanticTokensDelta -> SemanticTokensDelta -> Bool
$c> :: SemanticTokensDelta -> SemanticTokensDelta -> Bool
> :: SemanticTokensDelta -> SemanticTokensDelta -> Bool
$c>= :: SemanticTokensDelta -> SemanticTokensDelta -> Bool
>= :: SemanticTokensDelta -> SemanticTokensDelta -> Bool
$cmax :: SemanticTokensDelta -> SemanticTokensDelta -> SemanticTokensDelta
max :: SemanticTokensDelta -> SemanticTokensDelta -> SemanticTokensDelta
$cmin :: SemanticTokensDelta -> SemanticTokensDelta -> SemanticTokensDelta
min :: SemanticTokensDelta -> SemanticTokensDelta -> SemanticTokensDelta
Ord, (forall x. SemanticTokensDelta -> Rep SemanticTokensDelta x)
-> (forall x. Rep SemanticTokensDelta x -> SemanticTokensDelta)
-> Generic SemanticTokensDelta
forall x. Rep SemanticTokensDelta x -> SemanticTokensDelta
forall x. SemanticTokensDelta -> Rep SemanticTokensDelta x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. SemanticTokensDelta -> Rep SemanticTokensDelta x
from :: forall x. SemanticTokensDelta -> Rep SemanticTokensDelta x
$cto :: forall x. Rep SemanticTokensDelta x -> SemanticTokensDelta
to :: forall x. Rep SemanticTokensDelta x -> SemanticTokensDelta
Generic)
  deriving anyclass (SemanticTokensDelta -> ()
(SemanticTokensDelta -> ()) -> NFData SemanticTokensDelta
forall a. (a -> ()) -> NFData a
$crnf :: SemanticTokensDelta -> ()
rnf :: SemanticTokensDelta -> ()
NFData, Eq SemanticTokensDelta
Eq SemanticTokensDelta =>
(Int -> SemanticTokensDelta -> Int)
-> (SemanticTokensDelta -> Int) -> Hashable SemanticTokensDelta
Int -> SemanticTokensDelta -> Int
SemanticTokensDelta -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> SemanticTokensDelta -> Int
hashWithSalt :: Int -> SemanticTokensDelta -> Int
$chash :: SemanticTokensDelta -> Int
hash :: SemanticTokensDelta -> Int
Hashable)
  deriving (forall ann. SemanticTokensDelta -> Doc ann)
-> (forall ann. [SemanticTokensDelta] -> Doc ann)
-> Pretty SemanticTokensDelta
forall ann. [SemanticTokensDelta] -> Doc ann
forall ann. SemanticTokensDelta -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
$cpretty :: forall ann. SemanticTokensDelta -> Doc ann
pretty :: forall ann. SemanticTokensDelta -> Doc ann
$cprettyList :: forall ann. [SemanticTokensDelta] -> Doc ann
prettyList :: forall ann. [SemanticTokensDelta] -> Doc ann
Pretty via (ViaJSON SemanticTokensDelta)

instance Aeson.ToJSON SemanticTokensDelta where
  toJSON :: SemanticTokensDelta -> Value
toJSON (SemanticTokensDelta Maybe Text
arg0 [SemanticTokensEdit]
arg1) = [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
$  [String
"resultId" String -> Maybe Text -> [Pair]
forall e kv v.
(KeyValue e kv, ToJSON v) =>
String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Text
arg0
    ,[Key
"edits" Key -> [SemanticTokensEdit] -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= [SemanticTokensEdit]
arg1]]

instance Aeson.FromJSON SemanticTokensDelta where
  parseJSON :: Value -> Parser SemanticTokensDelta
parseJSON = String
-> (Object -> Parser SemanticTokensDelta)
-> Value
-> Parser SemanticTokensDelta
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"SemanticTokensDelta" ((Object -> Parser SemanticTokensDelta)
 -> Value -> Parser SemanticTokensDelta)
-> (Object -> Parser SemanticTokensDelta)
-> Value
-> Parser SemanticTokensDelta
forall a b. (a -> b) -> a -> b
$ \Object
arg -> Maybe Text -> [SemanticTokensEdit] -> SemanticTokensDelta
SemanticTokensDelta (Maybe Text -> [SemanticTokensEdit] -> SemanticTokensDelta)
-> Parser (Maybe Text)
-> Parser ([SemanticTokensEdit] -> SemanticTokensDelta)
forall (f :: * -> *) a b. Functor 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
"resultId" Parser ([SemanticTokensEdit] -> SemanticTokensDelta)
-> Parser [SemanticTokensEdit] -> Parser SemanticTokensDelta
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 [SemanticTokensEdit]
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"edits"