{- 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.StaleRequestSupportOptions 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.Types.Common

{-|
@since 3.18.0
@proposed
-}
data StaleRequestSupportOptions = StaleRequestSupportOptions 
  { {-|
  The client will actively cancel the request.
  -}
  StaleRequestSupportOptions -> Bool
_cancel :: Bool
  , {-|
  The list of requests for which the client
  will retry the request if it receives a
  response with error code `ContentModified`
  -}
  StaleRequestSupportOptions -> [Text]
_retryOnContentModified :: [Data.Text.Text]
  }
  deriving stock (Int -> StaleRequestSupportOptions -> ShowS
[StaleRequestSupportOptions] -> ShowS
StaleRequestSupportOptions -> String
(Int -> StaleRequestSupportOptions -> ShowS)
-> (StaleRequestSupportOptions -> String)
-> ([StaleRequestSupportOptions] -> ShowS)
-> Show StaleRequestSupportOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> StaleRequestSupportOptions -> ShowS
showsPrec :: Int -> StaleRequestSupportOptions -> ShowS
$cshow :: StaleRequestSupportOptions -> String
show :: StaleRequestSupportOptions -> String
$cshowList :: [StaleRequestSupportOptions] -> ShowS
showList :: [StaleRequestSupportOptions] -> ShowS
Show, StaleRequestSupportOptions -> StaleRequestSupportOptions -> Bool
(StaleRequestSupportOptions -> StaleRequestSupportOptions -> Bool)
-> (StaleRequestSupportOptions
    -> StaleRequestSupportOptions -> Bool)
-> Eq StaleRequestSupportOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: StaleRequestSupportOptions -> StaleRequestSupportOptions -> Bool
== :: StaleRequestSupportOptions -> StaleRequestSupportOptions -> Bool
$c/= :: StaleRequestSupportOptions -> StaleRequestSupportOptions -> Bool
/= :: StaleRequestSupportOptions -> StaleRequestSupportOptions -> Bool
Eq, Eq StaleRequestSupportOptions
Eq StaleRequestSupportOptions =>
(StaleRequestSupportOptions
 -> StaleRequestSupportOptions -> Ordering)
-> (StaleRequestSupportOptions
    -> StaleRequestSupportOptions -> Bool)
-> (StaleRequestSupportOptions
    -> StaleRequestSupportOptions -> Bool)
-> (StaleRequestSupportOptions
    -> StaleRequestSupportOptions -> Bool)
-> (StaleRequestSupportOptions
    -> StaleRequestSupportOptions -> Bool)
-> (StaleRequestSupportOptions
    -> StaleRequestSupportOptions -> StaleRequestSupportOptions)
-> (StaleRequestSupportOptions
    -> StaleRequestSupportOptions -> StaleRequestSupportOptions)
-> Ord StaleRequestSupportOptions
StaleRequestSupportOptions -> StaleRequestSupportOptions -> Bool
StaleRequestSupportOptions
-> StaleRequestSupportOptions -> Ordering
StaleRequestSupportOptions
-> StaleRequestSupportOptions -> StaleRequestSupportOptions
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 :: StaleRequestSupportOptions
-> StaleRequestSupportOptions -> Ordering
compare :: StaleRequestSupportOptions
-> StaleRequestSupportOptions -> Ordering
$c< :: StaleRequestSupportOptions -> StaleRequestSupportOptions -> Bool
< :: StaleRequestSupportOptions -> StaleRequestSupportOptions -> Bool
$c<= :: StaleRequestSupportOptions -> StaleRequestSupportOptions -> Bool
<= :: StaleRequestSupportOptions -> StaleRequestSupportOptions -> Bool
$c> :: StaleRequestSupportOptions -> StaleRequestSupportOptions -> Bool
> :: StaleRequestSupportOptions -> StaleRequestSupportOptions -> Bool
$c>= :: StaleRequestSupportOptions -> StaleRequestSupportOptions -> Bool
>= :: StaleRequestSupportOptions -> StaleRequestSupportOptions -> Bool
$cmax :: StaleRequestSupportOptions
-> StaleRequestSupportOptions -> StaleRequestSupportOptions
max :: StaleRequestSupportOptions
-> StaleRequestSupportOptions -> StaleRequestSupportOptions
$cmin :: StaleRequestSupportOptions
-> StaleRequestSupportOptions -> StaleRequestSupportOptions
min :: StaleRequestSupportOptions
-> StaleRequestSupportOptions -> StaleRequestSupportOptions
Ord, (forall x.
 StaleRequestSupportOptions -> Rep StaleRequestSupportOptions x)
-> (forall x.
    Rep StaleRequestSupportOptions x -> StaleRequestSupportOptions)
-> Generic StaleRequestSupportOptions
forall x.
Rep StaleRequestSupportOptions x -> StaleRequestSupportOptions
forall x.
StaleRequestSupportOptions -> Rep StaleRequestSupportOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x.
StaleRequestSupportOptions -> Rep StaleRequestSupportOptions x
from :: forall x.
StaleRequestSupportOptions -> Rep StaleRequestSupportOptions x
$cto :: forall x.
Rep StaleRequestSupportOptions x -> StaleRequestSupportOptions
to :: forall x.
Rep StaleRequestSupportOptions x -> StaleRequestSupportOptions
Generic)
  deriving anyclass (StaleRequestSupportOptions -> ()
(StaleRequestSupportOptions -> ())
-> NFData StaleRequestSupportOptions
forall a. (a -> ()) -> NFData a
$crnf :: StaleRequestSupportOptions -> ()
rnf :: StaleRequestSupportOptions -> ()
NFData, Eq StaleRequestSupportOptions
Eq StaleRequestSupportOptions =>
(Int -> StaleRequestSupportOptions -> Int)
-> (StaleRequestSupportOptions -> Int)
-> Hashable StaleRequestSupportOptions
Int -> StaleRequestSupportOptions -> Int
StaleRequestSupportOptions -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> StaleRequestSupportOptions -> Int
hashWithSalt :: Int -> StaleRequestSupportOptions -> Int
$chash :: StaleRequestSupportOptions -> Int
hash :: StaleRequestSupportOptions -> Int
Hashable)
  deriving (forall ann. StaleRequestSupportOptions -> Doc ann)
-> (forall ann. [StaleRequestSupportOptions] -> Doc ann)
-> Pretty StaleRequestSupportOptions
forall ann. [StaleRequestSupportOptions] -> Doc ann
forall ann. StaleRequestSupportOptions -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
$cpretty :: forall ann. StaleRequestSupportOptions -> Doc ann
pretty :: forall ann. StaleRequestSupportOptions -> Doc ann
$cprettyList :: forall ann. [StaleRequestSupportOptions] -> Doc ann
prettyList :: forall ann. [StaleRequestSupportOptions] -> Doc ann
Pretty via (ViaJSON StaleRequestSupportOptions)

instance Aeson.ToJSON StaleRequestSupportOptions where
  toJSON :: StaleRequestSupportOptions -> Value
toJSON (StaleRequestSupportOptions Bool
arg0 [Text]
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
"cancel" Key -> Bool -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= Bool
arg0]
    ,[Key
"retryOnContentModified" Key -> [Text] -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= [Text]
arg1]]

instance Aeson.FromJSON StaleRequestSupportOptions where
  parseJSON :: Value -> Parser StaleRequestSupportOptions
parseJSON = String
-> (Object -> Parser StaleRequestSupportOptions)
-> Value
-> Parser StaleRequestSupportOptions
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"StaleRequestSupportOptions" ((Object -> Parser StaleRequestSupportOptions)
 -> Value -> Parser StaleRequestSupportOptions)
-> (Object -> Parser StaleRequestSupportOptions)
-> Value
-> Parser StaleRequestSupportOptions
forall a b. (a -> b) -> a -> b
$ \Object
arg -> Bool -> [Text] -> StaleRequestSupportOptions
StaleRequestSupportOptions (Bool -> [Text] -> StaleRequestSupportOptions)
-> Parser Bool -> Parser ([Text] -> StaleRequestSupportOptions)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg Object -> Key -> Parser Bool
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"cancel" Parser ([Text] -> StaleRequestSupportOptions)
-> Parser [Text] -> Parser StaleRequestSupportOptions
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 [Text]
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"retryOnContentModified"