{- 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.FileSystemWatcher 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.GlobPattern
import qualified Language.LSP.Protocol.Internal.Types.WatchKind
import qualified Language.LSP.Protocol.Types.Common

{-|

-}
data FileSystemWatcher = FileSystemWatcher 
  { {-|
  The glob pattern to watch. See `GlobPattern` for more detail.

  @since 3.17.0 support for relative patterns.
  -}
  FileSystemWatcher -> GlobPattern
_globPattern :: Language.LSP.Protocol.Internal.Types.GlobPattern.GlobPattern
  , {-|
  The kind of events of interest. If omitted it defaults
  to WatchKind.Create | WatchKind.Change | WatchKind.Delete
  which is 7.
  -}
  FileSystemWatcher -> Maybe WatchKind
_kind :: (Maybe Language.LSP.Protocol.Internal.Types.WatchKind.WatchKind)
  }
  deriving stock (Int -> FileSystemWatcher -> ShowS
[FileSystemWatcher] -> ShowS
FileSystemWatcher -> String
(Int -> FileSystemWatcher -> ShowS)
-> (FileSystemWatcher -> String)
-> ([FileSystemWatcher] -> ShowS)
-> Show FileSystemWatcher
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FileSystemWatcher -> ShowS
showsPrec :: Int -> FileSystemWatcher -> ShowS
$cshow :: FileSystemWatcher -> String
show :: FileSystemWatcher -> String
$cshowList :: [FileSystemWatcher] -> ShowS
showList :: [FileSystemWatcher] -> ShowS
Show, FileSystemWatcher -> FileSystemWatcher -> Bool
(FileSystemWatcher -> FileSystemWatcher -> Bool)
-> (FileSystemWatcher -> FileSystemWatcher -> Bool)
-> Eq FileSystemWatcher
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FileSystemWatcher -> FileSystemWatcher -> Bool
== :: FileSystemWatcher -> FileSystemWatcher -> Bool
$c/= :: FileSystemWatcher -> FileSystemWatcher -> Bool
/= :: FileSystemWatcher -> FileSystemWatcher -> Bool
Eq, Eq FileSystemWatcher
Eq FileSystemWatcher =>
(FileSystemWatcher -> FileSystemWatcher -> Ordering)
-> (FileSystemWatcher -> FileSystemWatcher -> Bool)
-> (FileSystemWatcher -> FileSystemWatcher -> Bool)
-> (FileSystemWatcher -> FileSystemWatcher -> Bool)
-> (FileSystemWatcher -> FileSystemWatcher -> Bool)
-> (FileSystemWatcher -> FileSystemWatcher -> FileSystemWatcher)
-> (FileSystemWatcher -> FileSystemWatcher -> FileSystemWatcher)
-> Ord FileSystemWatcher
FileSystemWatcher -> FileSystemWatcher -> Bool
FileSystemWatcher -> FileSystemWatcher -> Ordering
FileSystemWatcher -> FileSystemWatcher -> FileSystemWatcher
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 :: FileSystemWatcher -> FileSystemWatcher -> Ordering
compare :: FileSystemWatcher -> FileSystemWatcher -> Ordering
$c< :: FileSystemWatcher -> FileSystemWatcher -> Bool
< :: FileSystemWatcher -> FileSystemWatcher -> Bool
$c<= :: FileSystemWatcher -> FileSystemWatcher -> Bool
<= :: FileSystemWatcher -> FileSystemWatcher -> Bool
$c> :: FileSystemWatcher -> FileSystemWatcher -> Bool
> :: FileSystemWatcher -> FileSystemWatcher -> Bool
$c>= :: FileSystemWatcher -> FileSystemWatcher -> Bool
>= :: FileSystemWatcher -> FileSystemWatcher -> Bool
$cmax :: FileSystemWatcher -> FileSystemWatcher -> FileSystemWatcher
max :: FileSystemWatcher -> FileSystemWatcher -> FileSystemWatcher
$cmin :: FileSystemWatcher -> FileSystemWatcher -> FileSystemWatcher
min :: FileSystemWatcher -> FileSystemWatcher -> FileSystemWatcher
Ord, (forall x. FileSystemWatcher -> Rep FileSystemWatcher x)
-> (forall x. Rep FileSystemWatcher x -> FileSystemWatcher)
-> Generic FileSystemWatcher
forall x. Rep FileSystemWatcher x -> FileSystemWatcher
forall x. FileSystemWatcher -> Rep FileSystemWatcher x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. FileSystemWatcher -> Rep FileSystemWatcher x
from :: forall x. FileSystemWatcher -> Rep FileSystemWatcher x
$cto :: forall x. Rep FileSystemWatcher x -> FileSystemWatcher
to :: forall x. Rep FileSystemWatcher x -> FileSystemWatcher
Generic)
  deriving anyclass (FileSystemWatcher -> ()
(FileSystemWatcher -> ()) -> NFData FileSystemWatcher
forall a. (a -> ()) -> NFData a
$crnf :: FileSystemWatcher -> ()
rnf :: FileSystemWatcher -> ()
NFData, Eq FileSystemWatcher
Eq FileSystemWatcher =>
(Int -> FileSystemWatcher -> Int)
-> (FileSystemWatcher -> Int) -> Hashable FileSystemWatcher
Int -> FileSystemWatcher -> Int
FileSystemWatcher -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> FileSystemWatcher -> Int
hashWithSalt :: Int -> FileSystemWatcher -> Int
$chash :: FileSystemWatcher -> Int
hash :: FileSystemWatcher -> Int
Hashable)
  deriving (forall ann. FileSystemWatcher -> Doc ann)
-> (forall ann. [FileSystemWatcher] -> Doc ann)
-> Pretty FileSystemWatcher
forall ann. [FileSystemWatcher] -> Doc ann
forall ann. FileSystemWatcher -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
$cpretty :: forall ann. FileSystemWatcher -> Doc ann
pretty :: forall ann. FileSystemWatcher -> Doc ann
$cprettyList :: forall ann. [FileSystemWatcher] -> Doc ann
prettyList :: forall ann. [FileSystemWatcher] -> Doc ann
Pretty via (ViaJSON FileSystemWatcher)

instance Aeson.ToJSON FileSystemWatcher where
  toJSON :: FileSystemWatcher -> Value
toJSON (FileSystemWatcher GlobPattern
arg0 Maybe WatchKind
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
"globPattern" Key -> GlobPattern -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= GlobPattern
arg0]
    ,String
"kind" String -> Maybe WatchKind -> [Pair]
forall e kv v.
(KeyValue e kv, ToJSON v) =>
String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe WatchKind
arg1]

instance Aeson.FromJSON FileSystemWatcher where
  parseJSON :: Value -> Parser FileSystemWatcher
parseJSON = String
-> (Object -> Parser FileSystemWatcher)
-> Value
-> Parser FileSystemWatcher
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"FileSystemWatcher" ((Object -> Parser FileSystemWatcher)
 -> Value -> Parser FileSystemWatcher)
-> (Object -> Parser FileSystemWatcher)
-> Value
-> Parser FileSystemWatcher
forall a b. (a -> b) -> a -> b
$ \Object
arg -> GlobPattern -> Maybe WatchKind -> FileSystemWatcher
FileSystemWatcher (GlobPattern -> Maybe WatchKind -> FileSystemWatcher)
-> Parser GlobPattern
-> Parser (Maybe WatchKind -> FileSystemWatcher)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg Object -> Key -> Parser GlobPattern
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"globPattern" Parser (Maybe WatchKind -> FileSystemWatcher)
-> Parser (Maybe WatchKind) -> Parser FileSystemWatcher
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 WatchKind)
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"kind"