{- 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.WorkDoneProgressReport 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
import qualified Language.LSP.Protocol.Types.Singletons

{-|

-}
data WorkDoneProgressReport = WorkDoneProgressReport 
  { {-|

  -}
  WorkDoneProgressReport -> AString "report"
_kind :: (Language.LSP.Protocol.Types.Singletons.AString "report")
  , {-|
  Controls enablement state of a cancel button.

  Clients that don't support cancellation or don't support controlling the button's
  enablement state are allowed to ignore the property.
  -}
  WorkDoneProgressReport -> Maybe Bool
_cancellable :: (Maybe Bool)
  , {-|
  Optional, more detailed associated progress message. Contains
  complementary information to the `title`.

  Examples: "3/25 files", "project/src/module2", "node_modules/some_dep".
  If unset, the previous progress message (if any) is still valid.
  -}
  WorkDoneProgressReport -> Maybe Text
_message :: (Maybe Data.Text.Text)
  , {-|
  Optional progress percentage to display (value 100 is considered 100%).
  If not provided infinite progress is assumed and clients are allowed
  to ignore the `percentage` value in subsequent in report notifications.

  The value should be steadily rising. Clients are free to ignore values
  that are not following this rule. The value range is [0, 100]
  -}
  WorkDoneProgressReport -> Maybe UInt
_percentage :: (Maybe Language.LSP.Protocol.Types.Common.UInt)
  }
  deriving stock (Int -> WorkDoneProgressReport -> ShowS
[WorkDoneProgressReport] -> ShowS
WorkDoneProgressReport -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkDoneProgressReport] -> ShowS
$cshowList :: [WorkDoneProgressReport] -> ShowS
show :: WorkDoneProgressReport -> String
$cshow :: WorkDoneProgressReport -> String
showsPrec :: Int -> WorkDoneProgressReport -> ShowS
$cshowsPrec :: Int -> WorkDoneProgressReport -> ShowS
Show, WorkDoneProgressReport -> WorkDoneProgressReport -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkDoneProgressReport -> WorkDoneProgressReport -> Bool
$c/= :: WorkDoneProgressReport -> WorkDoneProgressReport -> Bool
== :: WorkDoneProgressReport -> WorkDoneProgressReport -> Bool
$c== :: WorkDoneProgressReport -> WorkDoneProgressReport -> Bool
Eq, Eq WorkDoneProgressReport
WorkDoneProgressReport -> WorkDoneProgressReport -> Bool
WorkDoneProgressReport -> WorkDoneProgressReport -> Ordering
WorkDoneProgressReport
-> WorkDoneProgressReport -> WorkDoneProgressReport
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 :: WorkDoneProgressReport
-> WorkDoneProgressReport -> WorkDoneProgressReport
$cmin :: WorkDoneProgressReport
-> WorkDoneProgressReport -> WorkDoneProgressReport
max :: WorkDoneProgressReport
-> WorkDoneProgressReport -> WorkDoneProgressReport
$cmax :: WorkDoneProgressReport
-> WorkDoneProgressReport -> WorkDoneProgressReport
>= :: WorkDoneProgressReport -> WorkDoneProgressReport -> Bool
$c>= :: WorkDoneProgressReport -> WorkDoneProgressReport -> Bool
> :: WorkDoneProgressReport -> WorkDoneProgressReport -> Bool
$c> :: WorkDoneProgressReport -> WorkDoneProgressReport -> Bool
<= :: WorkDoneProgressReport -> WorkDoneProgressReport -> Bool
$c<= :: WorkDoneProgressReport -> WorkDoneProgressReport -> Bool
< :: WorkDoneProgressReport -> WorkDoneProgressReport -> Bool
$c< :: WorkDoneProgressReport -> WorkDoneProgressReport -> Bool
compare :: WorkDoneProgressReport -> WorkDoneProgressReport -> Ordering
$ccompare :: WorkDoneProgressReport -> WorkDoneProgressReport -> Ordering
Ord, forall x. Rep WorkDoneProgressReport x -> WorkDoneProgressReport
forall x. WorkDoneProgressReport -> Rep WorkDoneProgressReport x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WorkDoneProgressReport x -> WorkDoneProgressReport
$cfrom :: forall x. WorkDoneProgressReport -> Rep WorkDoneProgressReport x
Generic)
  deriving anyclass (WorkDoneProgressReport -> ()
forall a. (a -> ()) -> NFData a
rnf :: WorkDoneProgressReport -> ()
$crnf :: WorkDoneProgressReport -> ()
NFData, Eq WorkDoneProgressReport
Int -> WorkDoneProgressReport -> Int
WorkDoneProgressReport -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: WorkDoneProgressReport -> Int
$chash :: WorkDoneProgressReport -> Int
hashWithSalt :: Int -> WorkDoneProgressReport -> Int
$chashWithSalt :: Int -> WorkDoneProgressReport -> Int
Hashable)
  deriving forall ann. [WorkDoneProgressReport] -> Doc ann
forall ann. WorkDoneProgressReport -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [WorkDoneProgressReport] -> Doc ann
$cprettyList :: forall ann. [WorkDoneProgressReport] -> Doc ann
pretty :: forall ann. WorkDoneProgressReport -> Doc ann
$cpretty :: forall ann. WorkDoneProgressReport -> Doc ann
Pretty via (ViaJSON WorkDoneProgressReport)

instance Aeson.ToJSON WorkDoneProgressReport where
  toJSON :: WorkDoneProgressReport -> Value
toJSON (WorkDoneProgressReport AString "report"
arg0 Maybe Bool
arg1 Maybe Text
arg2 Maybe UInt
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
$  [[Key
"kind" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= AString "report"
arg0]
    ,String
"cancellable" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Bool
arg1
    ,String
"message" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Text
arg2
    ,String
"percentage" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe UInt
arg3]

instance Aeson.FromJSON WorkDoneProgressReport where
  parseJSON :: Value -> Parser WorkDoneProgressReport
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"WorkDoneProgressReport" forall a b. (a -> b) -> a -> b
$ \Object
arg -> AString "report"
-> Maybe Bool -> Maybe Text -> Maybe UInt -> WorkDoneProgressReport
WorkDoneProgressReport forall (f :: * -> *) a b. Functor 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 (Maybe a)
Aeson..:! Key
"cancellable" 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
"message" 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
"percentage"