{- 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.WorkDoneProgressBegin 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 WorkDoneProgressBegin = WorkDoneProgressBegin 
  { {-|

  -}
  WorkDoneProgressBegin -> AString "begin"
_kind :: (Language.LSP.Protocol.Types.Singletons.AString "begin")
  , {-|
  Mandatory title of the progress operation. Used to briefly inform about
  the kind of operation being performed.

  Examples: "Indexing" or "Linking dependencies".
  -}
  WorkDoneProgressBegin -> Text
_title :: Data.Text.Text
  , {-|
  Controls if a cancel button should show to allow the user to cancel the
  long running operation. Clients that don't support cancellation are allowed
  to ignore the setting.
  -}
  WorkDoneProgressBegin -> 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.
  -}
  WorkDoneProgressBegin -> 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].
  -}
  WorkDoneProgressBegin -> Maybe UInt
_percentage :: (Maybe Language.LSP.Protocol.Types.Common.UInt)
  }
  deriving stock (Int -> WorkDoneProgressBegin -> ShowS
[WorkDoneProgressBegin] -> ShowS
WorkDoneProgressBegin -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkDoneProgressBegin] -> ShowS
$cshowList :: [WorkDoneProgressBegin] -> ShowS
show :: WorkDoneProgressBegin -> String
$cshow :: WorkDoneProgressBegin -> String
showsPrec :: Int -> WorkDoneProgressBegin -> ShowS
$cshowsPrec :: Int -> WorkDoneProgressBegin -> ShowS
Show, WorkDoneProgressBegin -> WorkDoneProgressBegin -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkDoneProgressBegin -> WorkDoneProgressBegin -> Bool
$c/= :: WorkDoneProgressBegin -> WorkDoneProgressBegin -> Bool
== :: WorkDoneProgressBegin -> WorkDoneProgressBegin -> Bool
$c== :: WorkDoneProgressBegin -> WorkDoneProgressBegin -> Bool
Eq, Eq WorkDoneProgressBegin
WorkDoneProgressBegin -> WorkDoneProgressBegin -> Bool
WorkDoneProgressBegin -> WorkDoneProgressBegin -> Ordering
WorkDoneProgressBegin
-> WorkDoneProgressBegin -> WorkDoneProgressBegin
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 :: WorkDoneProgressBegin
-> WorkDoneProgressBegin -> WorkDoneProgressBegin
$cmin :: WorkDoneProgressBegin
-> WorkDoneProgressBegin -> WorkDoneProgressBegin
max :: WorkDoneProgressBegin
-> WorkDoneProgressBegin -> WorkDoneProgressBegin
$cmax :: WorkDoneProgressBegin
-> WorkDoneProgressBegin -> WorkDoneProgressBegin
>= :: WorkDoneProgressBegin -> WorkDoneProgressBegin -> Bool
$c>= :: WorkDoneProgressBegin -> WorkDoneProgressBegin -> Bool
> :: WorkDoneProgressBegin -> WorkDoneProgressBegin -> Bool
$c> :: WorkDoneProgressBegin -> WorkDoneProgressBegin -> Bool
<= :: WorkDoneProgressBegin -> WorkDoneProgressBegin -> Bool
$c<= :: WorkDoneProgressBegin -> WorkDoneProgressBegin -> Bool
< :: WorkDoneProgressBegin -> WorkDoneProgressBegin -> Bool
$c< :: WorkDoneProgressBegin -> WorkDoneProgressBegin -> Bool
compare :: WorkDoneProgressBegin -> WorkDoneProgressBegin -> Ordering
$ccompare :: WorkDoneProgressBegin -> WorkDoneProgressBegin -> Ordering
Ord, forall x. Rep WorkDoneProgressBegin x -> WorkDoneProgressBegin
forall x. WorkDoneProgressBegin -> Rep WorkDoneProgressBegin x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep WorkDoneProgressBegin x -> WorkDoneProgressBegin
$cfrom :: forall x. WorkDoneProgressBegin -> Rep WorkDoneProgressBegin x
Generic)
  deriving anyclass (WorkDoneProgressBegin -> ()
forall a. (a -> ()) -> NFData a
rnf :: WorkDoneProgressBegin -> ()
$crnf :: WorkDoneProgressBegin -> ()
NFData, Eq WorkDoneProgressBegin
Int -> WorkDoneProgressBegin -> Int
WorkDoneProgressBegin -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: WorkDoneProgressBegin -> Int
$chash :: WorkDoneProgressBegin -> Int
hashWithSalt :: Int -> WorkDoneProgressBegin -> Int
$chashWithSalt :: Int -> WorkDoneProgressBegin -> Int
Hashable)
  deriving forall ann. [WorkDoneProgressBegin] -> Doc ann
forall ann. WorkDoneProgressBegin -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [WorkDoneProgressBegin] -> Doc ann
$cprettyList :: forall ann. [WorkDoneProgressBegin] -> Doc ann
pretty :: forall ann. WorkDoneProgressBegin -> Doc ann
$cpretty :: forall ann. WorkDoneProgressBegin -> Doc ann
Pretty via (ViaJSON WorkDoneProgressBegin)

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

instance Aeson.FromJSON WorkDoneProgressBegin where
  parseJSON :: Value -> Parser WorkDoneProgressBegin
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"WorkDoneProgressBegin" forall a b. (a -> b) -> a -> b
$ \Object
arg -> AString "begin"
-> Text
-> Maybe Bool
-> Maybe Text
-> Maybe UInt
-> WorkDoneProgressBegin
WorkDoneProgressBegin 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 a
Aeson..: Key
"title" 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"