{- 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.DidChangeNotebookDocumentParams 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 Language.LSP.Protocol.Internal.Types.NotebookDocumentChangeEvent
import qualified Language.LSP.Protocol.Internal.Types.VersionedNotebookDocumentIdentifier
import qualified Language.LSP.Protocol.Types.Common

{-|
The params sent in a change notebook document notification.

@since 3.17.0
-}
data DidChangeNotebookDocumentParams = DidChangeNotebookDocumentParams 
  { {-|
  The notebook document that did change. The version number points
  to the version after all provided changes have been applied. If
  only the text document content of a cell changes the notebook version
  doesn't necessarily have to change.
  -}
  DidChangeNotebookDocumentParams
-> VersionedNotebookDocumentIdentifier
_notebookDocument :: Language.LSP.Protocol.Internal.Types.VersionedNotebookDocumentIdentifier.VersionedNotebookDocumentIdentifier
  , {-|
  The actual changes to the notebook document.

  The changes describe single state changes to the notebook document.
  So if there are two changes c1 (at array index 0) and c2 (at array
  index 1) for a notebook in state S then c1 moves the notebook from
  S to S' and c2 from S' to S''. So c1 is computed on the state S and
  c2 is computed on the state S'.

  To mirror the content of a notebook using change events use the following approach:
  - start with the same initial content
  - apply the 'notebookDocument/didChange' notifications in the order you receive them.
  - apply the `NotebookChangeEvent`s in a single notification in the order
    you receive them.
  -}
  DidChangeNotebookDocumentParams -> NotebookDocumentChangeEvent
_change :: Language.LSP.Protocol.Internal.Types.NotebookDocumentChangeEvent.NotebookDocumentChangeEvent
  }
  deriving stock (Int -> DidChangeNotebookDocumentParams -> ShowS
[DidChangeNotebookDocumentParams] -> ShowS
DidChangeNotebookDocumentParams -> String
(Int -> DidChangeNotebookDocumentParams -> ShowS)
-> (DidChangeNotebookDocumentParams -> String)
-> ([DidChangeNotebookDocumentParams] -> ShowS)
-> Show DidChangeNotebookDocumentParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DidChangeNotebookDocumentParams -> ShowS
showsPrec :: Int -> DidChangeNotebookDocumentParams -> ShowS
$cshow :: DidChangeNotebookDocumentParams -> String
show :: DidChangeNotebookDocumentParams -> String
$cshowList :: [DidChangeNotebookDocumentParams] -> ShowS
showList :: [DidChangeNotebookDocumentParams] -> ShowS
Show, DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams -> Bool
(DidChangeNotebookDocumentParams
 -> DidChangeNotebookDocumentParams -> Bool)
-> (DidChangeNotebookDocumentParams
    -> DidChangeNotebookDocumentParams -> Bool)
-> Eq DidChangeNotebookDocumentParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams -> Bool
== :: DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams -> Bool
$c/= :: DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams -> Bool
/= :: DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams -> Bool
Eq, Eq DidChangeNotebookDocumentParams
Eq DidChangeNotebookDocumentParams =>
(DidChangeNotebookDocumentParams
 -> DidChangeNotebookDocumentParams -> Ordering)
-> (DidChangeNotebookDocumentParams
    -> DidChangeNotebookDocumentParams -> Bool)
-> (DidChangeNotebookDocumentParams
    -> DidChangeNotebookDocumentParams -> Bool)
-> (DidChangeNotebookDocumentParams
    -> DidChangeNotebookDocumentParams -> Bool)
-> (DidChangeNotebookDocumentParams
    -> DidChangeNotebookDocumentParams -> Bool)
-> (DidChangeNotebookDocumentParams
    -> DidChangeNotebookDocumentParams
    -> DidChangeNotebookDocumentParams)
-> (DidChangeNotebookDocumentParams
    -> DidChangeNotebookDocumentParams
    -> DidChangeNotebookDocumentParams)
-> Ord DidChangeNotebookDocumentParams
DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams -> Bool
DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams -> Ordering
DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams
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 :: DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams -> Ordering
compare :: DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams -> Ordering
$c< :: DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams -> Bool
< :: DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams -> Bool
$c<= :: DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams -> Bool
<= :: DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams -> Bool
$c> :: DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams -> Bool
> :: DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams -> Bool
$c>= :: DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams -> Bool
>= :: DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams -> Bool
$cmax :: DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams
max :: DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams
$cmin :: DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams
min :: DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams
Ord, (forall x.
 DidChangeNotebookDocumentParams
 -> Rep DidChangeNotebookDocumentParams x)
-> (forall x.
    Rep DidChangeNotebookDocumentParams x
    -> DidChangeNotebookDocumentParams)
-> Generic DidChangeNotebookDocumentParams
forall x.
Rep DidChangeNotebookDocumentParams x
-> DidChangeNotebookDocumentParams
forall x.
DidChangeNotebookDocumentParams
-> Rep DidChangeNotebookDocumentParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x.
DidChangeNotebookDocumentParams
-> Rep DidChangeNotebookDocumentParams x
from :: forall x.
DidChangeNotebookDocumentParams
-> Rep DidChangeNotebookDocumentParams x
$cto :: forall x.
Rep DidChangeNotebookDocumentParams x
-> DidChangeNotebookDocumentParams
to :: forall x.
Rep DidChangeNotebookDocumentParams x
-> DidChangeNotebookDocumentParams
Generic)
  deriving anyclass (DidChangeNotebookDocumentParams -> ()
(DidChangeNotebookDocumentParams -> ())
-> NFData DidChangeNotebookDocumentParams
forall a. (a -> ()) -> NFData a
$crnf :: DidChangeNotebookDocumentParams -> ()
rnf :: DidChangeNotebookDocumentParams -> ()
NFData, Eq DidChangeNotebookDocumentParams
Eq DidChangeNotebookDocumentParams =>
(Int -> DidChangeNotebookDocumentParams -> Int)
-> (DidChangeNotebookDocumentParams -> Int)
-> Hashable DidChangeNotebookDocumentParams
Int -> DidChangeNotebookDocumentParams -> Int
DidChangeNotebookDocumentParams -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> DidChangeNotebookDocumentParams -> Int
hashWithSalt :: Int -> DidChangeNotebookDocumentParams -> Int
$chash :: DidChangeNotebookDocumentParams -> Int
hash :: DidChangeNotebookDocumentParams -> Int
Hashable)
  deriving (forall ann. DidChangeNotebookDocumentParams -> Doc ann)
-> (forall ann. [DidChangeNotebookDocumentParams] -> Doc ann)
-> Pretty DidChangeNotebookDocumentParams
forall ann. [DidChangeNotebookDocumentParams] -> Doc ann
forall ann. DidChangeNotebookDocumentParams -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
$cpretty :: forall ann. DidChangeNotebookDocumentParams -> Doc ann
pretty :: forall ann. DidChangeNotebookDocumentParams -> Doc ann
$cprettyList :: forall ann. [DidChangeNotebookDocumentParams] -> Doc ann
prettyList :: forall ann. [DidChangeNotebookDocumentParams] -> Doc ann
Pretty via (ViaJSON DidChangeNotebookDocumentParams)

instance Aeson.ToJSON DidChangeNotebookDocumentParams where
  toJSON :: DidChangeNotebookDocumentParams -> Value
toJSON (DidChangeNotebookDocumentParams VersionedNotebookDocumentIdentifier
arg0 NotebookDocumentChangeEvent
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
$  [[Key
"notebookDocument" Key -> VersionedNotebookDocumentIdentifier -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= VersionedNotebookDocumentIdentifier
arg0]
    ,[Key
"change" Key -> NotebookDocumentChangeEvent -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= NotebookDocumentChangeEvent
arg1]]

instance Aeson.FromJSON DidChangeNotebookDocumentParams where
  parseJSON :: Value -> Parser DidChangeNotebookDocumentParams
parseJSON = String
-> (Object -> Parser DidChangeNotebookDocumentParams)
-> Value
-> Parser DidChangeNotebookDocumentParams
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"DidChangeNotebookDocumentParams" ((Object -> Parser DidChangeNotebookDocumentParams)
 -> Value -> Parser DidChangeNotebookDocumentParams)
-> (Object -> Parser DidChangeNotebookDocumentParams)
-> Value
-> Parser DidChangeNotebookDocumentParams
forall a b. (a -> b) -> a -> b
$ \Object
arg -> VersionedNotebookDocumentIdentifier
-> NotebookDocumentChangeEvent -> DidChangeNotebookDocumentParams
DidChangeNotebookDocumentParams (VersionedNotebookDocumentIdentifier
 -> NotebookDocumentChangeEvent -> DidChangeNotebookDocumentParams)
-> Parser VersionedNotebookDocumentIdentifier
-> Parser
     (NotebookDocumentChangeEvent -> DidChangeNotebookDocumentParams)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg Object -> Key -> Parser VersionedNotebookDocumentIdentifier
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"notebookDocument" Parser
  (NotebookDocumentChangeEvent -> DidChangeNotebookDocumentParams)
-> Parser NotebookDocumentChangeEvent
-> Parser DidChangeNotebookDocumentParams
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 NotebookDocumentChangeEvent
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"change"