{- 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.FileEvent 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.FileChangeType
import qualified Language.LSP.Protocol.Types.Common
import qualified Language.LSP.Protocol.Types.Uri

{-|
An event describing a file change.
-}
data FileEvent = FileEvent 
  { {-|
  The file's uri.
  -}
  FileEvent -> Uri
_uri :: Language.LSP.Protocol.Types.Uri.Uri
  , {-|
  The change type.
  -}
  FileEvent -> FileChangeType
_type_ :: Language.LSP.Protocol.Internal.Types.FileChangeType.FileChangeType
  }
  deriving stock (Int -> FileEvent -> ShowS
[FileEvent] -> ShowS
FileEvent -> String
(Int -> FileEvent -> ShowS)
-> (FileEvent -> String)
-> ([FileEvent] -> ShowS)
-> Show FileEvent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FileEvent -> ShowS
showsPrec :: Int -> FileEvent -> ShowS
$cshow :: FileEvent -> String
show :: FileEvent -> String
$cshowList :: [FileEvent] -> ShowS
showList :: [FileEvent] -> ShowS
Show, FileEvent -> FileEvent -> Bool
(FileEvent -> FileEvent -> Bool)
-> (FileEvent -> FileEvent -> Bool) -> Eq FileEvent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FileEvent -> FileEvent -> Bool
== :: FileEvent -> FileEvent -> Bool
$c/= :: FileEvent -> FileEvent -> Bool
/= :: FileEvent -> FileEvent -> Bool
Eq, Eq FileEvent
Eq FileEvent =>
(FileEvent -> FileEvent -> Ordering)
-> (FileEvent -> FileEvent -> Bool)
-> (FileEvent -> FileEvent -> Bool)
-> (FileEvent -> FileEvent -> Bool)
-> (FileEvent -> FileEvent -> Bool)
-> (FileEvent -> FileEvent -> FileEvent)
-> (FileEvent -> FileEvent -> FileEvent)
-> Ord FileEvent
FileEvent -> FileEvent -> Bool
FileEvent -> FileEvent -> Ordering
FileEvent -> FileEvent -> FileEvent
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 :: FileEvent -> FileEvent -> Ordering
compare :: FileEvent -> FileEvent -> Ordering
$c< :: FileEvent -> FileEvent -> Bool
< :: FileEvent -> FileEvent -> Bool
$c<= :: FileEvent -> FileEvent -> Bool
<= :: FileEvent -> FileEvent -> Bool
$c> :: FileEvent -> FileEvent -> Bool
> :: FileEvent -> FileEvent -> Bool
$c>= :: FileEvent -> FileEvent -> Bool
>= :: FileEvent -> FileEvent -> Bool
$cmax :: FileEvent -> FileEvent -> FileEvent
max :: FileEvent -> FileEvent -> FileEvent
$cmin :: FileEvent -> FileEvent -> FileEvent
min :: FileEvent -> FileEvent -> FileEvent
Ord, (forall x. FileEvent -> Rep FileEvent x)
-> (forall x. Rep FileEvent x -> FileEvent) -> Generic FileEvent
forall x. Rep FileEvent x -> FileEvent
forall x. FileEvent -> Rep FileEvent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. FileEvent -> Rep FileEvent x
from :: forall x. FileEvent -> Rep FileEvent x
$cto :: forall x. Rep FileEvent x -> FileEvent
to :: forall x. Rep FileEvent x -> FileEvent
Generic)
  deriving anyclass (FileEvent -> ()
(FileEvent -> ()) -> NFData FileEvent
forall a. (a -> ()) -> NFData a
$crnf :: FileEvent -> ()
rnf :: FileEvent -> ()
NFData, Eq FileEvent
Eq FileEvent =>
(Int -> FileEvent -> Int)
-> (FileEvent -> Int) -> Hashable FileEvent
Int -> FileEvent -> Int
FileEvent -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> FileEvent -> Int
hashWithSalt :: Int -> FileEvent -> Int
$chash :: FileEvent -> Int
hash :: FileEvent -> Int
Hashable)
  deriving (forall ann. FileEvent -> Doc ann)
-> (forall ann. [FileEvent] -> Doc ann) -> Pretty FileEvent
forall ann. [FileEvent] -> Doc ann
forall ann. FileEvent -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
$cpretty :: forall ann. FileEvent -> Doc ann
pretty :: forall ann. FileEvent -> Doc ann
$cprettyList :: forall ann. [FileEvent] -> Doc ann
prettyList :: forall ann. [FileEvent] -> Doc ann
Pretty via (ViaJSON FileEvent)

instance Aeson.ToJSON FileEvent where
  toJSON :: FileEvent -> Value
toJSON (FileEvent Uri
arg0 FileChangeType
arg1) = [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
$  [[Key
"uri" Key -> Uri -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= Uri
arg0]
    ,[Key
"type" Key -> FileChangeType -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= FileChangeType
arg1]]

instance Aeson.FromJSON FileEvent where
  parseJSON :: Value -> Parser FileEvent
parseJSON = String -> (Object -> Parser FileEvent) -> Value -> Parser FileEvent
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"FileEvent" ((Object -> Parser FileEvent) -> Value -> Parser FileEvent)
-> (Object -> Parser FileEvent) -> Value -> Parser FileEvent
forall a b. (a -> b) -> a -> b
$ \Object
arg -> Uri -> FileChangeType -> FileEvent
FileEvent (Uri -> FileChangeType -> FileEvent)
-> Parser Uri -> Parser (FileChangeType -> FileEvent)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg Object -> Key -> Parser Uri
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"uri" Parser (FileChangeType -> FileEvent)
-> Parser FileChangeType -> Parser FileEvent
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 FileChangeType
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"type"