{- 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.FileOperationPattern 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 Data.Text
import qualified Language.LSP.Protocol.Internal.Types.FileOperationPatternKind
import qualified Language.LSP.Protocol.Internal.Types.FileOperationPatternOptions
import qualified Language.LSP.Protocol.Types.Common

{-|
A pattern to describe in which file operation requests or notifications
the server is interested in receiving.

@since 3.16.0
-}
data FileOperationPattern = FileOperationPattern 
  { {-|
  The glob pattern to match. Glob patterns can have the following syntax:
  - `*` to match one or more characters in a path segment
  - `?` to match on one character in a path segment
  - `**` to match any number of path segments, including none
  - `{}` to group sub patterns into an OR expression. (e.g. `**​/*.{ts,js}` matches all TypeScript and JavaScript files)
  - `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …)
  - `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`)
  -}
  FileOperationPattern -> Text
_glob :: Data.Text.Text
  , {-|
  Whether to match files or folders with this pattern.

  Matches both if undefined.
  -}
  FileOperationPattern -> Maybe FileOperationPatternKind
_matches :: (Maybe Language.LSP.Protocol.Internal.Types.FileOperationPatternKind.FileOperationPatternKind)
  , {-|
  Additional options used during matching.
  -}
  FileOperationPattern -> Maybe FileOperationPatternOptions
_options :: (Maybe Language.LSP.Protocol.Internal.Types.FileOperationPatternOptions.FileOperationPatternOptions)
  }
  deriving stock (Int -> FileOperationPattern -> ShowS
[FileOperationPattern] -> ShowS
FileOperationPattern -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FileOperationPattern] -> ShowS
$cshowList :: [FileOperationPattern] -> ShowS
show :: FileOperationPattern -> String
$cshow :: FileOperationPattern -> String
showsPrec :: Int -> FileOperationPattern -> ShowS
$cshowsPrec :: Int -> FileOperationPattern -> ShowS
Show, FileOperationPattern -> FileOperationPattern -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FileOperationPattern -> FileOperationPattern -> Bool
$c/= :: FileOperationPattern -> FileOperationPattern -> Bool
== :: FileOperationPattern -> FileOperationPattern -> Bool
$c== :: FileOperationPattern -> FileOperationPattern -> Bool
Eq, Eq FileOperationPattern
FileOperationPattern -> FileOperationPattern -> Bool
FileOperationPattern -> FileOperationPattern -> Ordering
FileOperationPattern
-> FileOperationPattern -> FileOperationPattern
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 :: FileOperationPattern
-> FileOperationPattern -> FileOperationPattern
$cmin :: FileOperationPattern
-> FileOperationPattern -> FileOperationPattern
max :: FileOperationPattern
-> FileOperationPattern -> FileOperationPattern
$cmax :: FileOperationPattern
-> FileOperationPattern -> FileOperationPattern
>= :: FileOperationPattern -> FileOperationPattern -> Bool
$c>= :: FileOperationPattern -> FileOperationPattern -> Bool
> :: FileOperationPattern -> FileOperationPattern -> Bool
$c> :: FileOperationPattern -> FileOperationPattern -> Bool
<= :: FileOperationPattern -> FileOperationPattern -> Bool
$c<= :: FileOperationPattern -> FileOperationPattern -> Bool
< :: FileOperationPattern -> FileOperationPattern -> Bool
$c< :: FileOperationPattern -> FileOperationPattern -> Bool
compare :: FileOperationPattern -> FileOperationPattern -> Ordering
$ccompare :: FileOperationPattern -> FileOperationPattern -> Ordering
Ord, forall x. Rep FileOperationPattern x -> FileOperationPattern
forall x. FileOperationPattern -> Rep FileOperationPattern x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FileOperationPattern x -> FileOperationPattern
$cfrom :: forall x. FileOperationPattern -> Rep FileOperationPattern x
Generic)
  deriving anyclass (FileOperationPattern -> ()
forall a. (a -> ()) -> NFData a
rnf :: FileOperationPattern -> ()
$crnf :: FileOperationPattern -> ()
NFData, Eq FileOperationPattern
Int -> FileOperationPattern -> Int
FileOperationPattern -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: FileOperationPattern -> Int
$chash :: FileOperationPattern -> Int
hashWithSalt :: Int -> FileOperationPattern -> Int
$chashWithSalt :: Int -> FileOperationPattern -> Int
Hashable)
  deriving forall ann. [FileOperationPattern] -> Doc ann
forall ann. FileOperationPattern -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [FileOperationPattern] -> Doc ann
$cprettyList :: forall ann. [FileOperationPattern] -> Doc ann
pretty :: forall ann. FileOperationPattern -> Doc ann
$cpretty :: forall ann. FileOperationPattern -> Doc ann
Pretty via (ViaJSON FileOperationPattern)

instance Aeson.ToJSON FileOperationPattern where
  toJSON :: FileOperationPattern -> Value
toJSON (FileOperationPattern Text
arg0 Maybe FileOperationPatternKind
arg1 Maybe FileOperationPatternOptions
arg2) = [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
$  [[Key
"glob" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Text
arg0]
    ,String
"matches" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe FileOperationPatternKind
arg1
    ,String
"options" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe FileOperationPatternOptions
arg2]

instance Aeson.FromJSON FileOperationPattern where
  parseJSON :: Value -> Parser FileOperationPattern
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"FileOperationPattern" forall a b. (a -> b) -> a -> b
$ \Object
arg -> Text
-> Maybe FileOperationPatternKind
-> Maybe FileOperationPatternOptions
-> FileOperationPattern
FileOperationPattern forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"glob" 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
"matches" 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"