{- 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.SaveOptions 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.Types.Common

{-|
Save options.
-}
data SaveOptions = SaveOptions 
  { {-|
  The client is supposed to include the content on save.
  -}
  SaveOptions -> Maybe Bool
_includeText :: (Maybe Bool)
  }
  deriving stock (Int -> SaveOptions -> ShowS
[SaveOptions] -> ShowS
SaveOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SaveOptions] -> ShowS
$cshowList :: [SaveOptions] -> ShowS
show :: SaveOptions -> String
$cshow :: SaveOptions -> String
showsPrec :: Int -> SaveOptions -> ShowS
$cshowsPrec :: Int -> SaveOptions -> ShowS
Show, SaveOptions -> SaveOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SaveOptions -> SaveOptions -> Bool
$c/= :: SaveOptions -> SaveOptions -> Bool
== :: SaveOptions -> SaveOptions -> Bool
$c== :: SaveOptions -> SaveOptions -> Bool
Eq, Eq SaveOptions
SaveOptions -> SaveOptions -> Bool
SaveOptions -> SaveOptions -> Ordering
SaveOptions -> SaveOptions -> SaveOptions
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 :: SaveOptions -> SaveOptions -> SaveOptions
$cmin :: SaveOptions -> SaveOptions -> SaveOptions
max :: SaveOptions -> SaveOptions -> SaveOptions
$cmax :: SaveOptions -> SaveOptions -> SaveOptions
>= :: SaveOptions -> SaveOptions -> Bool
$c>= :: SaveOptions -> SaveOptions -> Bool
> :: SaveOptions -> SaveOptions -> Bool
$c> :: SaveOptions -> SaveOptions -> Bool
<= :: SaveOptions -> SaveOptions -> Bool
$c<= :: SaveOptions -> SaveOptions -> Bool
< :: SaveOptions -> SaveOptions -> Bool
$c< :: SaveOptions -> SaveOptions -> Bool
compare :: SaveOptions -> SaveOptions -> Ordering
$ccompare :: SaveOptions -> SaveOptions -> Ordering
Ord, forall x. Rep SaveOptions x -> SaveOptions
forall x. SaveOptions -> Rep SaveOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SaveOptions x -> SaveOptions
$cfrom :: forall x. SaveOptions -> Rep SaveOptions x
Generic)
  deriving anyclass (SaveOptions -> ()
forall a. (a -> ()) -> NFData a
rnf :: SaveOptions -> ()
$crnf :: SaveOptions -> ()
NFData, Eq SaveOptions
Int -> SaveOptions -> Int
SaveOptions -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: SaveOptions -> Int
$chash :: SaveOptions -> Int
hashWithSalt :: Int -> SaveOptions -> Int
$chashWithSalt :: Int -> SaveOptions -> Int
Hashable)
  deriving forall ann. [SaveOptions] -> Doc ann
forall ann. SaveOptions -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [SaveOptions] -> Doc ann
$cprettyList :: forall ann. [SaveOptions] -> Doc ann
pretty :: forall ann. SaveOptions -> Doc ann
$cpretty :: forall ann. SaveOptions -> Doc ann
Pretty via (ViaJSON SaveOptions)

instance Aeson.ToJSON SaveOptions where
  toJSON :: SaveOptions -> Value
toJSON (SaveOptions Maybe Bool
arg0) = [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
$  [String
"includeText" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Bool
arg0]

instance Aeson.FromJSON SaveOptions where
  parseJSON :: Value -> Parser SaveOptions
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"SaveOptions" forall a b. (a -> b) -> a -> b
$ \Object
arg -> Maybe Bool -> SaveOptions
SaveOptions forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Aeson..:! Key
"includeText"