{- 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
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DidChangeNotebookDocumentParams] -> ShowS
$cshowList :: [DidChangeNotebookDocumentParams] -> ShowS
show :: DidChangeNotebookDocumentParams -> String
$cshow :: DidChangeNotebookDocumentParams -> String
showsPrec :: Int -> DidChangeNotebookDocumentParams -> ShowS
$cshowsPrec :: Int -> DidChangeNotebookDocumentParams -> ShowS
Show, DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams -> Bool
$c/= :: DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams -> Bool
== :: DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams -> Bool
$c== :: DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams -> Bool
Eq, Eq 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
min :: DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams
$cmin :: DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams
max :: DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams
$cmax :: DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams
>= :: DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams -> Bool
$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
compare :: DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams -> Ordering
$ccompare :: DidChangeNotebookDocumentParams
-> DidChangeNotebookDocumentParams -> Ordering
Ord, 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
$cto :: forall x.
Rep DidChangeNotebookDocumentParams x
-> DidChangeNotebookDocumentParams
$cfrom :: forall x.
DidChangeNotebookDocumentParams
-> Rep DidChangeNotebookDocumentParams x
Generic)
  deriving anyclass (DidChangeNotebookDocumentParams -> ()
forall a. (a -> ()) -> NFData a
rnf :: DidChangeNotebookDocumentParams -> ()
$crnf :: DidChangeNotebookDocumentParams -> ()
NFData, Eq DidChangeNotebookDocumentParams
Int -> DidChangeNotebookDocumentParams -> Int
DidChangeNotebookDocumentParams -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: DidChangeNotebookDocumentParams -> Int
$chash :: DidChangeNotebookDocumentParams -> Int
hashWithSalt :: Int -> DidChangeNotebookDocumentParams -> Int
$chashWithSalt :: Int -> DidChangeNotebookDocumentParams -> Int
Hashable)
  deriving forall ann. [DidChangeNotebookDocumentParams] -> Doc ann
forall ann. DidChangeNotebookDocumentParams -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [DidChangeNotebookDocumentParams] -> Doc ann
$cprettyList :: forall ann. [DidChangeNotebookDocumentParams] -> Doc ann
pretty :: forall ann. DidChangeNotebookDocumentParams -> Doc ann
$cpretty :: 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 forall a b. (a -> b) -> a -> b
$ forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat forall a b. (a -> b) -> a -> b
$  [[Key
"notebookDocument" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= VersionedNotebookDocumentIdentifier
arg0]
    ,[Key
"change" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= NotebookDocumentChangeEvent
arg1]]

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