{- 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
(Int -> NotebookCellArrayChange -> ShowS)
-> (NotebookCellArrayChange -> String)
-> ([NotebookCellArrayChange] -> ShowS)
-> Show NotebookCellArrayChange
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> NotebookCellArrayChange -> ShowS
showsPrec :: Int -> NotebookCellArrayChange -> ShowS
$cshow :: NotebookCellArrayChange -> String
show :: NotebookCellArrayChange -> String
$cshowList :: [NotebookCellArrayChange] -> ShowS
showList :: [NotebookCellArrayChange] -> ShowS
Show, NotebookCellArrayChange -> NotebookCellArrayChange -> Bool
(NotebookCellArrayChange -> NotebookCellArrayChange -> Bool)
-> (NotebookCellArrayChange -> NotebookCellArrayChange -> Bool)
-> Eq NotebookCellArrayChange
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: NotebookCellArrayChange -> NotebookCellArrayChange -> Bool
== :: NotebookCellArrayChange -> NotebookCellArrayChange -> Bool
$c/= :: NotebookCellArrayChange -> NotebookCellArrayChange -> Bool
/= :: NotebookCellArrayChange -> NotebookCellArrayChange -> Bool
Eq, Eq NotebookCellArrayChange
Eq NotebookCellArrayChange =>
(NotebookCellArrayChange -> NotebookCellArrayChange -> Ordering)
-> (NotebookCellArrayChange -> NotebookCellArrayChange -> Bool)
-> (NotebookCellArrayChange -> NotebookCellArrayChange -> Bool)
-> (NotebookCellArrayChange -> NotebookCellArrayChange -> Bool)
-> (NotebookCellArrayChange -> NotebookCellArrayChange -> Bool)
-> (NotebookCellArrayChange
    -> NotebookCellArrayChange -> NotebookCellArrayChange)
-> (NotebookCellArrayChange
    -> NotebookCellArrayChange -> NotebookCellArrayChange)
-> Ord 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
$ccompare :: NotebookCellArrayChange -> NotebookCellArrayChange -> Ordering
compare :: NotebookCellArrayChange -> NotebookCellArrayChange -> Ordering
$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
>= :: NotebookCellArrayChange -> NotebookCellArrayChange -> Bool
$cmax :: NotebookCellArrayChange
-> NotebookCellArrayChange -> NotebookCellArrayChange
max :: NotebookCellArrayChange
-> NotebookCellArrayChange -> NotebookCellArrayChange
$cmin :: NotebookCellArrayChange
-> NotebookCellArrayChange -> NotebookCellArrayChange
min :: NotebookCellArrayChange
-> NotebookCellArrayChange -> NotebookCellArrayChange
Ord, (forall x.
 NotebookCellArrayChange -> Rep NotebookCellArrayChange x)
-> (forall x.
    Rep NotebookCellArrayChange x -> NotebookCellArrayChange)
-> Generic NotebookCellArrayChange
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
$cfrom :: forall x. NotebookCellArrayChange -> Rep NotebookCellArrayChange x
from :: forall x. NotebookCellArrayChange -> Rep NotebookCellArrayChange x
$cto :: forall x. Rep NotebookCellArrayChange x -> NotebookCellArrayChange
to :: forall x. Rep NotebookCellArrayChange x -> NotebookCellArrayChange
Generic)
  deriving anyclass (NotebookCellArrayChange -> ()
(NotebookCellArrayChange -> ()) -> NFData NotebookCellArrayChange
forall a. (a -> ()) -> NFData a
$crnf :: NotebookCellArrayChange -> ()
rnf :: NotebookCellArrayChange -> ()
NFData, Eq NotebookCellArrayChange
Eq NotebookCellArrayChange =>
(Int -> NotebookCellArrayChange -> Int)
-> (NotebookCellArrayChange -> Int)
-> Hashable NotebookCellArrayChange
Int -> NotebookCellArrayChange -> Int
NotebookCellArrayChange -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> NotebookCellArrayChange -> Int
hashWithSalt :: Int -> NotebookCellArrayChange -> Int
$chash :: NotebookCellArrayChange -> Int
hash :: NotebookCellArrayChange -> Int
Hashable)
  deriving (forall ann. NotebookCellArrayChange -> Doc ann)
-> (forall ann. [NotebookCellArrayChange] -> Doc ann)
-> Pretty NotebookCellArrayChange
forall ann. [NotebookCellArrayChange] -> Doc ann
forall ann. NotebookCellArrayChange -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
$cpretty :: forall ann. NotebookCellArrayChange -> Doc ann
pretty :: forall ann. NotebookCellArrayChange -> Doc ann
$cprettyList :: forall ann. [NotebookCellArrayChange] -> Doc ann
prettyList :: 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 ([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
"start" Key -> UInt -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= UInt
arg0]
    ,[Key
"deleteCount" Key -> UInt -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= UInt
arg1]
    ,String
"cells" String -> Maybe [NotebookCell] -> [Pair]
forall e kv v.
(KeyValue e 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 = String
-> (Object -> Parser NotebookCellArrayChange)
-> Value
-> Parser NotebookCellArrayChange
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"NotebookCellArrayChange" ((Object -> Parser NotebookCellArrayChange)
 -> Value -> Parser NotebookCellArrayChange)
-> (Object -> Parser NotebookCellArrayChange)
-> Value
-> Parser NotebookCellArrayChange
forall a b. (a -> b) -> a -> b
$ \Object
arg -> UInt -> UInt -> Maybe [NotebookCell] -> NotebookCellArrayChange
NotebookCellArrayChange (UInt -> UInt -> Maybe [NotebookCell] -> NotebookCellArrayChange)
-> Parser UInt
-> Parser (UInt -> Maybe [NotebookCell] -> NotebookCellArrayChange)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg Object -> Key -> Parser UInt
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"start" Parser (UInt -> Maybe [NotebookCell] -> NotebookCellArrayChange)
-> Parser UInt
-> Parser (Maybe [NotebookCell] -> NotebookCellArrayChange)
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 UInt
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"deleteCount" Parser (Maybe [NotebookCell] -> NotebookCellArrayChange)
-> Parser (Maybe [NotebookCell]) -> Parser NotebookCellArrayChange
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 (Maybe [NotebookCell])
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"cells"