{- 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.NotebookDocumentSyncOptions 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 as Row
import qualified Data.Row.Aeson as Aeson
import qualified Data.Row.Hashable as Hashable
import qualified Data.Text
import qualified Language.LSP.Protocol.Internal.Types.NotebookDocumentFilter
import qualified Language.LSP.Protocol.Types.Common

{-|
Options specific to a notebook plus its cells
to be synced to the server.

If a selector provides a notebook document
filter but no cell selector all cells of a
matching notebook document will be synced.

If a selector provides no notebook document
filter but only a cell selector all notebook
document that contain at least one matching
cell will be synced.

@since 3.17.0
-}
data NotebookDocumentSyncOptions = NotebookDocumentSyncOptions 
  { {-|
  The notebooks to be synced
  -}
  NotebookDocumentSyncOptions
-> [Rec
      (Extend "notebook" (Text |? NotebookDocumentFilter) ('R '[])
       .+ (("cells"
            .== Maybe [Rec (Extend "language" Text ('R '[]) .+ 'R '[])])
           .+ 'R '[]))
    |? Rec
         (Extend
            "notebook" (Maybe (Text |? NotebookDocumentFilter)) ('R '[])
          .+ (("cells" .== [Rec (Extend "language" Text ('R '[]) .+ 'R '[])])
              .+ 'R '[]))]
_notebookSelector :: [((Row.Rec ("notebook" Row..== (Data.Text.Text Language.LSP.Protocol.Types.Common.|? Language.LSP.Protocol.Internal.Types.NotebookDocumentFilter.NotebookDocumentFilter) Row..+ ("cells" Row..== (Maybe [(Row.Rec ("language" Row..== Data.Text.Text Row..+ Row.Empty))]) Row..+ Row.Empty))) Language.LSP.Protocol.Types.Common.|? (Row.Rec ("notebook" Row..== (Maybe (Data.Text.Text Language.LSP.Protocol.Types.Common.|? Language.LSP.Protocol.Internal.Types.NotebookDocumentFilter.NotebookDocumentFilter)) Row..+ ("cells" Row..== [(Row.Rec ("language" Row..== Data.Text.Text Row..+ Row.Empty))] Row..+ Row.Empty))))]
  , {-|
  Whether save notification should be forwarded to
  the server. Will only be honored if mode === `notebook`.
  -}
  NotebookDocumentSyncOptions -> Maybe Bool
_save :: (Maybe Bool)
  }
  deriving stock (Int -> NotebookDocumentSyncOptions -> ShowS
[NotebookDocumentSyncOptions] -> ShowS
NotebookDocumentSyncOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NotebookDocumentSyncOptions] -> ShowS
$cshowList :: [NotebookDocumentSyncOptions] -> ShowS
show :: NotebookDocumentSyncOptions -> String
$cshow :: NotebookDocumentSyncOptions -> String
showsPrec :: Int -> NotebookDocumentSyncOptions -> ShowS
$cshowsPrec :: Int -> NotebookDocumentSyncOptions -> ShowS
Show, NotebookDocumentSyncOptions -> NotebookDocumentSyncOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NotebookDocumentSyncOptions -> NotebookDocumentSyncOptions -> Bool
$c/= :: NotebookDocumentSyncOptions -> NotebookDocumentSyncOptions -> Bool
== :: NotebookDocumentSyncOptions -> NotebookDocumentSyncOptions -> Bool
$c== :: NotebookDocumentSyncOptions -> NotebookDocumentSyncOptions -> Bool
Eq, Eq NotebookDocumentSyncOptions
NotebookDocumentSyncOptions -> NotebookDocumentSyncOptions -> Bool
NotebookDocumentSyncOptions
-> NotebookDocumentSyncOptions -> Ordering
NotebookDocumentSyncOptions
-> NotebookDocumentSyncOptions -> NotebookDocumentSyncOptions
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 :: NotebookDocumentSyncOptions
-> NotebookDocumentSyncOptions -> NotebookDocumentSyncOptions
$cmin :: NotebookDocumentSyncOptions
-> NotebookDocumentSyncOptions -> NotebookDocumentSyncOptions
max :: NotebookDocumentSyncOptions
-> NotebookDocumentSyncOptions -> NotebookDocumentSyncOptions
$cmax :: NotebookDocumentSyncOptions
-> NotebookDocumentSyncOptions -> NotebookDocumentSyncOptions
>= :: NotebookDocumentSyncOptions -> NotebookDocumentSyncOptions -> Bool
$c>= :: NotebookDocumentSyncOptions -> NotebookDocumentSyncOptions -> Bool
> :: NotebookDocumentSyncOptions -> NotebookDocumentSyncOptions -> Bool
$c> :: NotebookDocumentSyncOptions -> NotebookDocumentSyncOptions -> Bool
<= :: NotebookDocumentSyncOptions -> NotebookDocumentSyncOptions -> Bool
$c<= :: NotebookDocumentSyncOptions -> NotebookDocumentSyncOptions -> Bool
< :: NotebookDocumentSyncOptions -> NotebookDocumentSyncOptions -> Bool
$c< :: NotebookDocumentSyncOptions -> NotebookDocumentSyncOptions -> Bool
compare :: NotebookDocumentSyncOptions
-> NotebookDocumentSyncOptions -> Ordering
$ccompare :: NotebookDocumentSyncOptions
-> NotebookDocumentSyncOptions -> Ordering
Ord, forall x.
Rep NotebookDocumentSyncOptions x -> NotebookDocumentSyncOptions
forall x.
NotebookDocumentSyncOptions -> Rep NotebookDocumentSyncOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep NotebookDocumentSyncOptions x -> NotebookDocumentSyncOptions
$cfrom :: forall x.
NotebookDocumentSyncOptions -> Rep NotebookDocumentSyncOptions x
Generic)
  deriving anyclass (NotebookDocumentSyncOptions -> ()
forall a. (a -> ()) -> NFData a
rnf :: NotebookDocumentSyncOptions -> ()
$crnf :: NotebookDocumentSyncOptions -> ()
NFData, Eq NotebookDocumentSyncOptions
Int -> NotebookDocumentSyncOptions -> Int
NotebookDocumentSyncOptions -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: NotebookDocumentSyncOptions -> Int
$chash :: NotebookDocumentSyncOptions -> Int
hashWithSalt :: Int -> NotebookDocumentSyncOptions -> Int
$chashWithSalt :: Int -> NotebookDocumentSyncOptions -> Int
Hashable)
  deriving forall ann. [NotebookDocumentSyncOptions] -> Doc ann
forall ann. NotebookDocumentSyncOptions -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [NotebookDocumentSyncOptions] -> Doc ann
$cprettyList :: forall ann. [NotebookDocumentSyncOptions] -> Doc ann
pretty :: forall ann. NotebookDocumentSyncOptions -> Doc ann
$cpretty :: forall ann. NotebookDocumentSyncOptions -> Doc ann
Pretty via (ViaJSON NotebookDocumentSyncOptions)

instance Aeson.ToJSON NotebookDocumentSyncOptions where
  toJSON :: NotebookDocumentSyncOptions -> Value
toJSON (NotebookDocumentSyncOptions [Rec
   (Extend "notebook" (Text |? NotebookDocumentFilter) ('R '[])
    .+ (("cells"
         .== Maybe [Rec (Extend "language" Text ('R '[]) .+ 'R '[])])
        .+ 'R '[]))
 |? Rec
      (Extend
         "notebook" (Maybe (Text |? NotebookDocumentFilter)) ('R '[])
       .+ (("cells" .== [Rec (Extend "language" Text ('R '[]) .+ 'R '[])])
           .+ 'R '[]))]
arg0 Maybe Bool
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
"notebookSelector" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= [Rec
   (Extend "notebook" (Text |? NotebookDocumentFilter) ('R '[])
    .+ (("cells"
         .== Maybe [Rec (Extend "language" Text ('R '[]) .+ 'R '[])])
        .+ 'R '[]))
 |? Rec
      (Extend
         "notebook" (Maybe (Text |? NotebookDocumentFilter)) ('R '[])
       .+ (("cells" .== [Rec (Extend "language" Text ('R '[]) .+ 'R '[])])
           .+ 'R '[]))]
arg0]
    ,String
"save" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Bool
arg1]

instance Aeson.FromJSON NotebookDocumentSyncOptions where
  parseJSON :: Value -> Parser NotebookDocumentSyncOptions
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"NotebookDocumentSyncOptions" forall a b. (a -> b) -> a -> b
$ \Object
arg -> [Rec
   (Extend "notebook" (Text |? NotebookDocumentFilter) ('R '[])
    .+ (("cells"
         .== Maybe [Rec (Extend "language" Text ('R '[]) .+ 'R '[])])
        .+ 'R '[]))
 |? Rec
      (Extend
         "notebook" (Maybe (Text |? NotebookDocumentFilter)) ('R '[])
       .+ (("cells" .== [Rec (Extend "language" Text ('R '[]) .+ 'R '[])])
           .+ 'R '[]))]
-> Maybe Bool -> NotebookDocumentSyncOptions
NotebookDocumentSyncOptions forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"notebookSelector" 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
"save"