{- 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.CreateFileOptions 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

{-|
Options to create a file.
-}
data CreateFileOptions = CreateFileOptions 
  { {-|
  Overwrite existing file. Overwrite wins over `ignoreIfExists`
  -}
  CreateFileOptions -> Maybe Bool
_overwrite :: (Maybe Bool)
  , {-|
  Ignore if exists.
  -}
  CreateFileOptions -> Maybe Bool
_ignoreIfExists :: (Maybe Bool)
  }
  deriving stock (Int -> CreateFileOptions -> ShowS
[CreateFileOptions] -> ShowS
CreateFileOptions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateFileOptions] -> ShowS
$cshowList :: [CreateFileOptions] -> ShowS
show :: CreateFileOptions -> String
$cshow :: CreateFileOptions -> String
showsPrec :: Int -> CreateFileOptions -> ShowS
$cshowsPrec :: Int -> CreateFileOptions -> ShowS
Show, CreateFileOptions -> CreateFileOptions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateFileOptions -> CreateFileOptions -> Bool
$c/= :: CreateFileOptions -> CreateFileOptions -> Bool
== :: CreateFileOptions -> CreateFileOptions -> Bool
$c== :: CreateFileOptions -> CreateFileOptions -> Bool
Eq, Eq CreateFileOptions
CreateFileOptions -> CreateFileOptions -> Bool
CreateFileOptions -> CreateFileOptions -> Ordering
CreateFileOptions -> CreateFileOptions -> CreateFileOptions
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 :: CreateFileOptions -> CreateFileOptions -> CreateFileOptions
$cmin :: CreateFileOptions -> CreateFileOptions -> CreateFileOptions
max :: CreateFileOptions -> CreateFileOptions -> CreateFileOptions
$cmax :: CreateFileOptions -> CreateFileOptions -> CreateFileOptions
>= :: CreateFileOptions -> CreateFileOptions -> Bool
$c>= :: CreateFileOptions -> CreateFileOptions -> Bool
> :: CreateFileOptions -> CreateFileOptions -> Bool
$c> :: CreateFileOptions -> CreateFileOptions -> Bool
<= :: CreateFileOptions -> CreateFileOptions -> Bool
$c<= :: CreateFileOptions -> CreateFileOptions -> Bool
< :: CreateFileOptions -> CreateFileOptions -> Bool
$c< :: CreateFileOptions -> CreateFileOptions -> Bool
compare :: CreateFileOptions -> CreateFileOptions -> Ordering
$ccompare :: CreateFileOptions -> CreateFileOptions -> Ordering
Ord, forall x. Rep CreateFileOptions x -> CreateFileOptions
forall x. CreateFileOptions -> Rep CreateFileOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateFileOptions x -> CreateFileOptions
$cfrom :: forall x. CreateFileOptions -> Rep CreateFileOptions x
Generic)
  deriving anyclass (CreateFileOptions -> ()
forall a. (a -> ()) -> NFData a
rnf :: CreateFileOptions -> ()
$crnf :: CreateFileOptions -> ()
NFData, Eq CreateFileOptions
Int -> CreateFileOptions -> Int
CreateFileOptions -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: CreateFileOptions -> Int
$chash :: CreateFileOptions -> Int
hashWithSalt :: Int -> CreateFileOptions -> Int
$chashWithSalt :: Int -> CreateFileOptions -> Int
Hashable)
  deriving forall ann. [CreateFileOptions] -> Doc ann
forall ann. CreateFileOptions -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [CreateFileOptions] -> Doc ann
$cprettyList :: forall ann. [CreateFileOptions] -> Doc ann
pretty :: forall ann. CreateFileOptions -> Doc ann
$cpretty :: forall ann. CreateFileOptions -> Doc ann
Pretty via (ViaJSON CreateFileOptions)

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

instance Aeson.FromJSON CreateFileOptions where
  parseJSON :: Value -> Parser CreateFileOptions
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"CreateFileOptions" forall a b. (a -> b) -> a -> b
$ \Object
arg -> Maybe Bool -> Maybe Bool -> CreateFileOptions
CreateFileOptions 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
"overwrite" 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
"ignoreIfExists"