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

{-|
A change describing how to move a `NotebookCell`
array from state S to S'.

@since 3.17.0
-}
data NotebookCellArrayChange = NotebookCellArrayChange 
  { {-|
  The start oftest of the cell that changed.
  -}
  NotebookCellArrayChange -> UInt
_start :: Language.LSP.Protocol.Types.Common.UInt
  , {-|
  The deleted cells
  -}
  NotebookCellArrayChange -> UInt
_deleteCount :: Language.LSP.Protocol.Types.Common.UInt
  , {-|
  The new cells, if any
  -}
  NotebookCellArrayChange -> Maybe [NotebookCell]
_cells :: (Maybe [Language.LSP.Protocol.Internal.Types.NotebookCell.NotebookCell])
  }
  deriving stock (Int -> NotebookCellArrayChange -> ShowS
[NotebookCellArrayChange] -> ShowS
NotebookCellArrayChange -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NotebookCellArrayChange] -> ShowS
$cshowList :: [NotebookCellArrayChange] -> ShowS
show :: NotebookCellArrayChange -> String
$cshow :: NotebookCellArrayChange -> String
showsPrec :: Int -> NotebookCellArrayChange -> ShowS
$cshowsPrec :: Int -> NotebookCellArrayChange -> ShowS
Show, NotebookCellArrayChange -> NotebookCellArrayChange -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NotebookCellArrayChange -> NotebookCellArrayChange -> Bool
$c/= :: NotebookCellArrayChange -> NotebookCellArrayChange -> Bool
== :: NotebookCellArrayChange -> NotebookCellArrayChange -> Bool
$c== :: NotebookCellArrayChange -> NotebookCellArrayChange -> Bool
Eq, Eq NotebookCellArrayChange
NotebookCellArrayChange -> NotebookCellArrayChange -> Bool
NotebookCellArrayChange -> NotebookCellArrayChange -> Ordering
NotebookCellArrayChange
-> NotebookCellArrayChange -> NotebookCellArrayChange
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 :: NotebookCellArrayChange
-> NotebookCellArrayChange -> NotebookCellArrayChange
$cmin :: NotebookCellArrayChange
-> NotebookCellArrayChange -> NotebookCellArrayChange
max :: NotebookCellArrayChange
-> NotebookCellArrayChange -> NotebookCellArrayChange
$cmax :: NotebookCellArrayChange
-> NotebookCellArrayChange -> NotebookCellArrayChange
>= :: NotebookCellArrayChange -> NotebookCellArrayChange -> Bool
$c>= :: NotebookCellArrayChange -> NotebookCellArrayChange -> Bool
> :: NotebookCellArrayChange -> NotebookCellArrayChange -> Bool
$c> :: NotebookCellArrayChange -> NotebookCellArrayChange -> Bool
<= :: NotebookCellArrayChange -> NotebookCellArrayChange -> Bool
$c<= :: NotebookCellArrayChange -> NotebookCellArrayChange -> Bool
< :: NotebookCellArrayChange -> NotebookCellArrayChange -> Bool
$c< :: NotebookCellArrayChange -> NotebookCellArrayChange -> Bool
compare :: NotebookCellArrayChange -> NotebookCellArrayChange -> Ordering
$ccompare :: NotebookCellArrayChange -> NotebookCellArrayChange -> Ordering
Ord, forall x. Rep NotebookCellArrayChange x -> NotebookCellArrayChange
forall x. NotebookCellArrayChange -> Rep NotebookCellArrayChange x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NotebookCellArrayChange x -> NotebookCellArrayChange
$cfrom :: forall x. NotebookCellArrayChange -> Rep NotebookCellArrayChange x
Generic)
  deriving anyclass (NotebookCellArrayChange -> ()
forall a. (a -> ()) -> NFData a
rnf :: NotebookCellArrayChange -> ()
$crnf :: NotebookCellArrayChange -> ()
NFData, Eq NotebookCellArrayChange
Int -> NotebookCellArrayChange -> Int
NotebookCellArrayChange -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: NotebookCellArrayChange -> Int
$chash :: NotebookCellArrayChange -> Int
hashWithSalt :: Int -> NotebookCellArrayChange -> Int
$chashWithSalt :: Int -> NotebookCellArrayChange -> Int
Hashable)
  deriving forall ann. [NotebookCellArrayChange] -> Doc ann
forall ann. NotebookCellArrayChange -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [NotebookCellArrayChange] -> Doc ann
$cprettyList :: forall ann. [NotebookCellArrayChange] -> Doc ann
pretty :: forall ann. NotebookCellArrayChange -> Doc ann
$cpretty :: forall ann. NotebookCellArrayChange -> Doc ann
Pretty via (ViaJSON NotebookCellArrayChange)

instance Aeson.ToJSON NotebookCellArrayChange where
  toJSON :: NotebookCellArrayChange -> Value
toJSON (NotebookCellArrayChange UInt
arg0 UInt
arg1 Maybe [NotebookCell]
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
"start" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= UInt
arg0]
    ,[Key
"deleteCount" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= UInt
arg1]
    ,String
"cells" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe [NotebookCell]
arg2]

instance Aeson.FromJSON NotebookCellArrayChange where
  parseJSON :: Value -> Parser NotebookCellArrayChange
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"NotebookCellArrayChange" forall a b. (a -> b) -> a -> b
$ \Object
arg -> UInt -> UInt -> Maybe [NotebookCell] -> NotebookCellArrayChange
NotebookCellArrayChange forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"start" 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
"deleteCount" 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
"cells"