{- 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.NotebookCell where

import Control.DeepSeq
import Data.Hashable
import GHC.Generics
import Language.LSP.Protocol.Utils.Misc
import Prettyprinter
import qualified Data.Aeson
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.ExecutionSummary
import qualified Language.LSP.Protocol.Internal.Types.NotebookCellKind
import qualified Language.LSP.Protocol.Types.Common
import qualified Language.LSP.Protocol.Types.Uri

{-|
A notebook cell.

A cell's document URI must be unique across ALL notebook
cells and can therefore be used to uniquely identify a
notebook cell or the cell's text document.

@since 3.17.0
-}
data NotebookCell = NotebookCell 
  { {-|
  The cell's kind
  -}
  NotebookCell -> NotebookCellKind
_kind :: Language.LSP.Protocol.Internal.Types.NotebookCellKind.NotebookCellKind
  , {-|
  The URI of the cell's text document
  content.
  -}
  NotebookCell -> Uri
_document :: Language.LSP.Protocol.Types.Uri.Uri
  , {-|
  Additional metadata stored with the cell.

  Note: should always be an object literal (e.g. LSPObject)
  -}
  NotebookCell -> Maybe Object
_metadata :: (Maybe Data.Aeson.Object)
  , {-|
  Additional execution summary information
  if supported by the client.
  -}
  NotebookCell -> Maybe ExecutionSummary
_executionSummary :: (Maybe Language.LSP.Protocol.Internal.Types.ExecutionSummary.ExecutionSummary)
  }
  deriving stock (Int -> NotebookCell -> ShowS
[NotebookCell] -> ShowS
NotebookCell -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NotebookCell] -> ShowS
$cshowList :: [NotebookCell] -> ShowS
show :: NotebookCell -> String
$cshow :: NotebookCell -> String
showsPrec :: Int -> NotebookCell -> ShowS
$cshowsPrec :: Int -> NotebookCell -> ShowS
Show, NotebookCell -> NotebookCell -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NotebookCell -> NotebookCell -> Bool
$c/= :: NotebookCell -> NotebookCell -> Bool
== :: NotebookCell -> NotebookCell -> Bool
$c== :: NotebookCell -> NotebookCell -> Bool
Eq, Eq NotebookCell
NotebookCell -> NotebookCell -> Bool
NotebookCell -> NotebookCell -> Ordering
NotebookCell -> NotebookCell -> NotebookCell
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 :: NotebookCell -> NotebookCell -> NotebookCell
$cmin :: NotebookCell -> NotebookCell -> NotebookCell
max :: NotebookCell -> NotebookCell -> NotebookCell
$cmax :: NotebookCell -> NotebookCell -> NotebookCell
>= :: NotebookCell -> NotebookCell -> Bool
$c>= :: NotebookCell -> NotebookCell -> Bool
> :: NotebookCell -> NotebookCell -> Bool
$c> :: NotebookCell -> NotebookCell -> Bool
<= :: NotebookCell -> NotebookCell -> Bool
$c<= :: NotebookCell -> NotebookCell -> Bool
< :: NotebookCell -> NotebookCell -> Bool
$c< :: NotebookCell -> NotebookCell -> Bool
compare :: NotebookCell -> NotebookCell -> Ordering
$ccompare :: NotebookCell -> NotebookCell -> Ordering
Ord, forall x. Rep NotebookCell x -> NotebookCell
forall x. NotebookCell -> Rep NotebookCell x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NotebookCell x -> NotebookCell
$cfrom :: forall x. NotebookCell -> Rep NotebookCell x
Generic)
  deriving anyclass (NotebookCell -> ()
forall a. (a -> ()) -> NFData a
rnf :: NotebookCell -> ()
$crnf :: NotebookCell -> ()
NFData, Eq NotebookCell
Int -> NotebookCell -> Int
NotebookCell -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: NotebookCell -> Int
$chash :: NotebookCell -> Int
hashWithSalt :: Int -> NotebookCell -> Int
$chashWithSalt :: Int -> NotebookCell -> Int
Hashable)
  deriving forall ann. [NotebookCell] -> Doc ann
forall ann. NotebookCell -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [NotebookCell] -> Doc ann
$cprettyList :: forall ann. [NotebookCell] -> Doc ann
pretty :: forall ann. NotebookCell -> Doc ann
$cpretty :: forall ann. NotebookCell -> Doc ann
Pretty via (ViaJSON NotebookCell)

instance Aeson.ToJSON NotebookCell where
  toJSON :: NotebookCell -> Value
toJSON (NotebookCell NotebookCellKind
arg0 Uri
arg1 Maybe Object
arg2 Maybe ExecutionSummary
arg3) = [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
"kind" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= NotebookCellKind
arg0]
    ,[Key
"document" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Uri
arg1]
    ,String
"metadata" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Object
arg2
    ,String
"executionSummary" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe ExecutionSummary
arg3]

instance Aeson.FromJSON NotebookCell where
  parseJSON :: Value -> Parser NotebookCell
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"NotebookCell" forall a b. (a -> b) -> a -> b
$ \Object
arg -> NotebookCellKind
-> Uri -> Maybe Object -> Maybe ExecutionSummary -> NotebookCell
NotebookCell forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"kind" 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
"document" 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
"metadata" 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
"executionSummary"