{- 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.TextDocumentSyncOptions 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.SaveOptions
import qualified Language.LSP.Protocol.Internal.Types.TextDocumentSyncKind
import qualified Language.LSP.Protocol.Types.Common

{-|

-}
data TextDocumentSyncOptions = TextDocumentSyncOptions 
  { {-|
  Open and close notifications are sent to the server. If omitted open close notification should not
  be sent.
  -}
  TextDocumentSyncOptions -> Maybe Bool
_openClose :: (Maybe Bool)
  , {-|
  Change notifications are sent to the server. See TextDocumentSyncKind.None, TextDocumentSyncKind.Full
  and TextDocumentSyncKind.Incremental. If omitted it defaults to TextDocumentSyncKind.None.
  -}
  TextDocumentSyncOptions -> Maybe TextDocumentSyncKind
_change :: (Maybe Language.LSP.Protocol.Internal.Types.TextDocumentSyncKind.TextDocumentSyncKind)
  , {-|
  If present will save notifications are sent to the server. If omitted the notification should not be
  sent.
  -}
  TextDocumentSyncOptions -> Maybe Bool
_willSave :: (Maybe Bool)
  , {-|
  If present will save wait until requests are sent to the server. If omitted the request should not be
  sent.
  -}
  TextDocumentSyncOptions -> Maybe Bool
_willSaveWaitUntil :: (Maybe Bool)
  , {-|
  If present save notifications are sent to the server. If omitted the notification should not be
  sent.
  -}
  TextDocumentSyncOptions -> Maybe (Bool |? SaveOptions)
_save :: (Maybe (Bool Language.LSP.Protocol.Types.Common.|? Language.LSP.Protocol.Internal.Types.SaveOptions.SaveOptions))
  }
  deriving stock (Int -> TextDocumentSyncOptions -> ShowS
[TextDocumentSyncOptions] -> ShowS
TextDocumentSyncOptions -> String
(Int -> TextDocumentSyncOptions -> ShowS)
-> (TextDocumentSyncOptions -> String)
-> ([TextDocumentSyncOptions] -> ShowS)
-> Show TextDocumentSyncOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TextDocumentSyncOptions -> ShowS
showsPrec :: Int -> TextDocumentSyncOptions -> ShowS
$cshow :: TextDocumentSyncOptions -> String
show :: TextDocumentSyncOptions -> String
$cshowList :: [TextDocumentSyncOptions] -> ShowS
showList :: [TextDocumentSyncOptions] -> ShowS
Show, TextDocumentSyncOptions -> TextDocumentSyncOptions -> Bool
(TextDocumentSyncOptions -> TextDocumentSyncOptions -> Bool)
-> (TextDocumentSyncOptions -> TextDocumentSyncOptions -> Bool)
-> Eq TextDocumentSyncOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TextDocumentSyncOptions -> TextDocumentSyncOptions -> Bool
== :: TextDocumentSyncOptions -> TextDocumentSyncOptions -> Bool
$c/= :: TextDocumentSyncOptions -> TextDocumentSyncOptions -> Bool
/= :: TextDocumentSyncOptions -> TextDocumentSyncOptions -> Bool
Eq, Eq TextDocumentSyncOptions
Eq TextDocumentSyncOptions =>
(TextDocumentSyncOptions -> TextDocumentSyncOptions -> Ordering)
-> (TextDocumentSyncOptions -> TextDocumentSyncOptions -> Bool)
-> (TextDocumentSyncOptions -> TextDocumentSyncOptions -> Bool)
-> (TextDocumentSyncOptions -> TextDocumentSyncOptions -> Bool)
-> (TextDocumentSyncOptions -> TextDocumentSyncOptions -> Bool)
-> (TextDocumentSyncOptions
    -> TextDocumentSyncOptions -> TextDocumentSyncOptions)
-> (TextDocumentSyncOptions
    -> TextDocumentSyncOptions -> TextDocumentSyncOptions)
-> Ord TextDocumentSyncOptions
TextDocumentSyncOptions -> TextDocumentSyncOptions -> Bool
TextDocumentSyncOptions -> TextDocumentSyncOptions -> Ordering
TextDocumentSyncOptions
-> TextDocumentSyncOptions -> TextDocumentSyncOptions
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 :: TextDocumentSyncOptions -> TextDocumentSyncOptions -> Ordering
compare :: TextDocumentSyncOptions -> TextDocumentSyncOptions -> Ordering
$c< :: TextDocumentSyncOptions -> TextDocumentSyncOptions -> Bool
< :: TextDocumentSyncOptions -> TextDocumentSyncOptions -> Bool
$c<= :: TextDocumentSyncOptions -> TextDocumentSyncOptions -> Bool
<= :: TextDocumentSyncOptions -> TextDocumentSyncOptions -> Bool
$c> :: TextDocumentSyncOptions -> TextDocumentSyncOptions -> Bool
> :: TextDocumentSyncOptions -> TextDocumentSyncOptions -> Bool
$c>= :: TextDocumentSyncOptions -> TextDocumentSyncOptions -> Bool
>= :: TextDocumentSyncOptions -> TextDocumentSyncOptions -> Bool
$cmax :: TextDocumentSyncOptions
-> TextDocumentSyncOptions -> TextDocumentSyncOptions
max :: TextDocumentSyncOptions
-> TextDocumentSyncOptions -> TextDocumentSyncOptions
$cmin :: TextDocumentSyncOptions
-> TextDocumentSyncOptions -> TextDocumentSyncOptions
min :: TextDocumentSyncOptions
-> TextDocumentSyncOptions -> TextDocumentSyncOptions
Ord, (forall x.
 TextDocumentSyncOptions -> Rep TextDocumentSyncOptions x)
-> (forall x.
    Rep TextDocumentSyncOptions x -> TextDocumentSyncOptions)
-> Generic TextDocumentSyncOptions
forall x. Rep TextDocumentSyncOptions x -> TextDocumentSyncOptions
forall x. TextDocumentSyncOptions -> Rep TextDocumentSyncOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. TextDocumentSyncOptions -> Rep TextDocumentSyncOptions x
from :: forall x. TextDocumentSyncOptions -> Rep TextDocumentSyncOptions x
$cto :: forall x. Rep TextDocumentSyncOptions x -> TextDocumentSyncOptions
to :: forall x. Rep TextDocumentSyncOptions x -> TextDocumentSyncOptions
Generic)
  deriving anyclass (TextDocumentSyncOptions -> ()
(TextDocumentSyncOptions -> ()) -> NFData TextDocumentSyncOptions
forall a. (a -> ()) -> NFData a
$crnf :: TextDocumentSyncOptions -> ()
rnf :: TextDocumentSyncOptions -> ()
NFData, Eq TextDocumentSyncOptions
Eq TextDocumentSyncOptions =>
(Int -> TextDocumentSyncOptions -> Int)
-> (TextDocumentSyncOptions -> Int)
-> Hashable TextDocumentSyncOptions
Int -> TextDocumentSyncOptions -> Int
TextDocumentSyncOptions -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> TextDocumentSyncOptions -> Int
hashWithSalt :: Int -> TextDocumentSyncOptions -> Int
$chash :: TextDocumentSyncOptions -> Int
hash :: TextDocumentSyncOptions -> Int
Hashable)
  deriving (forall ann. TextDocumentSyncOptions -> Doc ann)
-> (forall ann. [TextDocumentSyncOptions] -> Doc ann)
-> Pretty TextDocumentSyncOptions
forall ann. [TextDocumentSyncOptions] -> Doc ann
forall ann. TextDocumentSyncOptions -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
$cpretty :: forall ann. TextDocumentSyncOptions -> Doc ann
pretty :: forall ann. TextDocumentSyncOptions -> Doc ann
$cprettyList :: forall ann. [TextDocumentSyncOptions] -> Doc ann
prettyList :: forall ann. [TextDocumentSyncOptions] -> Doc ann
Pretty via (ViaJSON TextDocumentSyncOptions)

instance Aeson.ToJSON TextDocumentSyncOptions where
  toJSON :: TextDocumentSyncOptions -> Value
toJSON (TextDocumentSyncOptions Maybe Bool
arg0 Maybe TextDocumentSyncKind
arg1 Maybe Bool
arg2 Maybe Bool
arg3 Maybe (Bool |? SaveOptions)
arg4) = [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
$  [String
"openClose" String -> Maybe Bool -> [Pair]
forall e kv v.
(KeyValue e kv, ToJSON v) =>
String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Bool
arg0
    ,String
"change" String -> Maybe TextDocumentSyncKind -> [Pair]
forall e kv v.
(KeyValue e kv, ToJSON v) =>
String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe TextDocumentSyncKind
arg1
    ,String
"willSave" String -> Maybe Bool -> [Pair]
forall e kv v.
(KeyValue e kv, ToJSON v) =>
String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Bool
arg2
    ,String
"willSaveWaitUntil" String -> Maybe Bool -> [Pair]
forall e kv v.
(KeyValue e kv, ToJSON v) =>
String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Bool
arg3
    ,String
"save" String -> Maybe (Bool |? SaveOptions) -> [Pair]
forall e kv v.
(KeyValue e kv, ToJSON v) =>
String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe (Bool |? SaveOptions)
arg4]

instance Aeson.FromJSON TextDocumentSyncOptions where
  parseJSON :: Value -> Parser TextDocumentSyncOptions
parseJSON = String
-> (Object -> Parser TextDocumentSyncOptions)
-> Value
-> Parser TextDocumentSyncOptions
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"TextDocumentSyncOptions" ((Object -> Parser TextDocumentSyncOptions)
 -> Value -> Parser TextDocumentSyncOptions)
-> (Object -> Parser TextDocumentSyncOptions)
-> Value
-> Parser TextDocumentSyncOptions
forall a b. (a -> b) -> a -> b
$ \Object
arg -> Maybe Bool
-> Maybe TextDocumentSyncKind
-> Maybe Bool
-> Maybe Bool
-> Maybe (Bool |? SaveOptions)
-> TextDocumentSyncOptions
TextDocumentSyncOptions (Maybe Bool
 -> Maybe TextDocumentSyncKind
 -> Maybe Bool
 -> Maybe Bool
 -> Maybe (Bool |? SaveOptions)
 -> TextDocumentSyncOptions)
-> Parser (Maybe Bool)
-> Parser
     (Maybe TextDocumentSyncKind
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe (Bool |? SaveOptions)
      -> TextDocumentSyncOptions)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg Object -> Key -> Parser (Maybe Bool)
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"openClose" Parser
  (Maybe TextDocumentSyncKind
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe (Bool |? SaveOptions)
   -> TextDocumentSyncOptions)
-> Parser (Maybe TextDocumentSyncKind)
-> Parser
     (Maybe Bool
      -> Maybe Bool
      -> Maybe (Bool |? SaveOptions)
      -> TextDocumentSyncOptions)
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 TextDocumentSyncKind)
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"change" Parser
  (Maybe Bool
   -> Maybe Bool
   -> Maybe (Bool |? SaveOptions)
   -> TextDocumentSyncOptions)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Bool
      -> Maybe (Bool |? SaveOptions) -> TextDocumentSyncOptions)
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 Bool)
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"willSave" Parser
  (Maybe Bool
   -> Maybe (Bool |? SaveOptions) -> TextDocumentSyncOptions)
-> Parser (Maybe Bool)
-> Parser (Maybe (Bool |? SaveOptions) -> TextDocumentSyncOptions)
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 Bool)
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"willSaveWaitUntil" Parser (Maybe (Bool |? SaveOptions) -> TextDocumentSyncOptions)
-> Parser (Maybe (Bool |? SaveOptions))
-> Parser TextDocumentSyncOptions
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 (Bool |? SaveOptions))
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"save"