{- 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.CreateFile 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.ChangeAnnotationIdentifier
import qualified Language.LSP.Protocol.Internal.Types.CreateFileOptions
import qualified Language.LSP.Protocol.Types.Common
import qualified Language.LSP.Protocol.Types.Singletons
import qualified Language.LSP.Protocol.Types.Uri

{-|
Create file operation.
-}
data CreateFile = CreateFile 
  { {-|
  An optional annotation identifier describing the operation.

  @since 3.16.0
  -}
  CreateFile -> Maybe ChangeAnnotationIdentifier
_annotationId :: (Maybe Language.LSP.Protocol.Internal.Types.ChangeAnnotationIdentifier.ChangeAnnotationIdentifier)
  , {-|
  A create
  -}
  CreateFile -> AString "create"
_kind :: (Language.LSP.Protocol.Types.Singletons.AString "create")
  , {-|
  The resource to create.
  -}
  CreateFile -> Uri
_uri :: Language.LSP.Protocol.Types.Uri.Uri
  , {-|
  Additional options
  -}
  CreateFile -> Maybe CreateFileOptions
_options :: (Maybe Language.LSP.Protocol.Internal.Types.CreateFileOptions.CreateFileOptions)
  }
  deriving stock (Int -> CreateFile -> ShowS
[CreateFile] -> ShowS
CreateFile -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateFile] -> ShowS
$cshowList :: [CreateFile] -> ShowS
show :: CreateFile -> String
$cshow :: CreateFile -> String
showsPrec :: Int -> CreateFile -> ShowS
$cshowsPrec :: Int -> CreateFile -> ShowS
Show, CreateFile -> CreateFile -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateFile -> CreateFile -> Bool
$c/= :: CreateFile -> CreateFile -> Bool
== :: CreateFile -> CreateFile -> Bool
$c== :: CreateFile -> CreateFile -> Bool
Eq, Eq CreateFile
CreateFile -> CreateFile -> Bool
CreateFile -> CreateFile -> Ordering
CreateFile -> CreateFile -> CreateFile
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 :: CreateFile -> CreateFile -> CreateFile
$cmin :: CreateFile -> CreateFile -> CreateFile
max :: CreateFile -> CreateFile -> CreateFile
$cmax :: CreateFile -> CreateFile -> CreateFile
>= :: CreateFile -> CreateFile -> Bool
$c>= :: CreateFile -> CreateFile -> Bool
> :: CreateFile -> CreateFile -> Bool
$c> :: CreateFile -> CreateFile -> Bool
<= :: CreateFile -> CreateFile -> Bool
$c<= :: CreateFile -> CreateFile -> Bool
< :: CreateFile -> CreateFile -> Bool
$c< :: CreateFile -> CreateFile -> Bool
compare :: CreateFile -> CreateFile -> Ordering
$ccompare :: CreateFile -> CreateFile -> Ordering
Ord, forall x. Rep CreateFile x -> CreateFile
forall x. CreateFile -> Rep CreateFile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateFile x -> CreateFile
$cfrom :: forall x. CreateFile -> Rep CreateFile x
Generic)
  deriving anyclass (CreateFile -> ()
forall a. (a -> ()) -> NFData a
rnf :: CreateFile -> ()
$crnf :: CreateFile -> ()
NFData, Eq CreateFile
Int -> CreateFile -> Int
CreateFile -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: CreateFile -> Int
$chash :: CreateFile -> Int
hashWithSalt :: Int -> CreateFile -> Int
$chashWithSalt :: Int -> CreateFile -> Int
Hashable)
  deriving forall ann. [CreateFile] -> Doc ann
forall ann. CreateFile -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [CreateFile] -> Doc ann
$cprettyList :: forall ann. [CreateFile] -> Doc ann
pretty :: forall ann. CreateFile -> Doc ann
$cpretty :: forall ann. CreateFile -> Doc ann
Pretty via (ViaJSON CreateFile)

instance Aeson.ToJSON CreateFile where
  toJSON :: CreateFile -> Value
toJSON (CreateFile Maybe ChangeAnnotationIdentifier
arg0 AString "create"
arg1 Uri
arg2 Maybe CreateFileOptions
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
$  [String
"annotationId" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe ChangeAnnotationIdentifier
arg0
    ,[Key
"kind" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= AString "create"
arg1]
    ,[Key
"uri" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Uri
arg2]
    ,String
"options" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe CreateFileOptions
arg3]

instance Aeson.FromJSON CreateFile where
  parseJSON :: Value -> Parser CreateFile
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"CreateFile" forall a b. (a -> b) -> a -> b
$ \Object
arg -> Maybe ChangeAnnotationIdentifier
-> AString "create" -> Uri -> Maybe CreateFileOptions -> CreateFile
CreateFile 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
"annotationId" 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
"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
"uri" 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
"options"