{- 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
(Int -> WorkDoneProgressBegin -> ShowS)
-> (WorkDoneProgressBegin -> String)
-> ([WorkDoneProgressBegin] -> ShowS)
-> Show WorkDoneProgressBegin
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> WorkDoneProgressBegin -> ShowS
showsPrec :: Int -> WorkDoneProgressBegin -> ShowS
$cshow :: WorkDoneProgressBegin -> String
show :: WorkDoneProgressBegin -> String
$cshowList :: [WorkDoneProgressBegin] -> ShowS
showList :: [WorkDoneProgressBegin] -> ShowS
Show, WorkDoneProgressBegin -> WorkDoneProgressBegin -> Bool
(WorkDoneProgressBegin -> WorkDoneProgressBegin -> Bool)
-> (WorkDoneProgressBegin -> WorkDoneProgressBegin -> Bool)
-> Eq WorkDoneProgressBegin
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: WorkDoneProgressBegin -> WorkDoneProgressBegin -> Bool
== :: WorkDoneProgressBegin -> WorkDoneProgressBegin -> Bool
$c/= :: WorkDoneProgressBegin -> WorkDoneProgressBegin -> Bool
/= :: WorkDoneProgressBegin -> WorkDoneProgressBegin -> Bool
Eq, Eq WorkDoneProgressBegin
Eq WorkDoneProgressBegin =>
(WorkDoneProgressBegin -> WorkDoneProgressBegin -> Ordering)
-> (WorkDoneProgressBegin -> WorkDoneProgressBegin -> Bool)
-> (WorkDoneProgressBegin -> WorkDoneProgressBegin -> Bool)
-> (WorkDoneProgressBegin -> WorkDoneProgressBegin -> Bool)
-> (WorkDoneProgressBegin -> WorkDoneProgressBegin -> Bool)
-> (WorkDoneProgressBegin
    -> WorkDoneProgressBegin -> WorkDoneProgressBegin)
-> (WorkDoneProgressBegin
    -> WorkDoneProgressBegin -> WorkDoneProgressBegin)
-> Ord 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
$ccompare :: WorkDoneProgressBegin -> WorkDoneProgressBegin -> Ordering
compare :: WorkDoneProgressBegin -> WorkDoneProgressBegin -> Ordering
$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
>= :: WorkDoneProgressBegin -> WorkDoneProgressBegin -> Bool
$cmax :: WorkDoneProgressBegin
-> WorkDoneProgressBegin -> WorkDoneProgressBegin
max :: WorkDoneProgressBegin
-> WorkDoneProgressBegin -> WorkDoneProgressBegin
$cmin :: WorkDoneProgressBegin
-> WorkDoneProgressBegin -> WorkDoneProgressBegin
min :: WorkDoneProgressBegin
-> WorkDoneProgressBegin -> WorkDoneProgressBegin
Ord, (forall x. WorkDoneProgressBegin -> Rep WorkDoneProgressBegin x)
-> (forall x. Rep WorkDoneProgressBegin x -> WorkDoneProgressBegin)
-> Generic WorkDoneProgressBegin
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
$cfrom :: forall x. WorkDoneProgressBegin -> Rep WorkDoneProgressBegin x
from :: forall x. WorkDoneProgressBegin -> Rep WorkDoneProgressBegin x
$cto :: forall x. Rep WorkDoneProgressBegin x -> WorkDoneProgressBegin
to :: forall x. Rep WorkDoneProgressBegin x -> WorkDoneProgressBegin
Generic)
  deriving anyclass (WorkDoneProgressBegin -> ()
(WorkDoneProgressBegin -> ()) -> NFData WorkDoneProgressBegin
forall a. (a -> ()) -> NFData a
$crnf :: WorkDoneProgressBegin -> ()
rnf :: WorkDoneProgressBegin -> ()
NFData, Eq WorkDoneProgressBegin
Eq WorkDoneProgressBegin =>
(Int -> WorkDoneProgressBegin -> Int)
-> (WorkDoneProgressBegin -> Int) -> Hashable WorkDoneProgressBegin
Int -> WorkDoneProgressBegin -> Int
WorkDoneProgressBegin -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> WorkDoneProgressBegin -> Int
hashWithSalt :: Int -> WorkDoneProgressBegin -> Int
$chash :: WorkDoneProgressBegin -> Int
hash :: WorkDoneProgressBegin -> Int
Hashable)
  deriving (forall ann. WorkDoneProgressBegin -> Doc ann)
-> (forall ann. [WorkDoneProgressBegin] -> Doc ann)
-> Pretty WorkDoneProgressBegin
forall ann. [WorkDoneProgressBegin] -> Doc ann
forall ann. WorkDoneProgressBegin -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
$cpretty :: forall ann. WorkDoneProgressBegin -> Doc ann
pretty :: forall ann. WorkDoneProgressBegin -> Doc ann
$cprettyList :: forall ann. [WorkDoneProgressBegin] -> Doc ann
prettyList :: 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 ([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
"kind" Key -> AString "begin" -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= AString "begin"
arg0]
    ,[Key
"title" 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]
    ,String
"cancellable" String -> Maybe Bool -> [Pair]
forall e kv v.
(KeyValue e kv, ToJSON v) =>
String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Bool
arg2
    ,String
"message" String -> Maybe Text -> [Pair]
forall e kv v.
(KeyValue e kv, ToJSON v) =>
String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Text
arg3
    ,String
"percentage" String -> Maybe UInt -> [Pair]
forall e kv v.
(KeyValue e 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 = String
-> (Object -> Parser WorkDoneProgressBegin)
-> Value
-> Parser WorkDoneProgressBegin
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"WorkDoneProgressBegin" ((Object -> Parser WorkDoneProgressBegin)
 -> Value -> Parser WorkDoneProgressBegin)
-> (Object -> Parser WorkDoneProgressBegin)
-> Value
-> Parser WorkDoneProgressBegin
forall a b. (a -> b) -> a -> b
$ \Object
arg -> AString "begin"
-> Text
-> Maybe Bool
-> Maybe Text
-> Maybe UInt
-> WorkDoneProgressBegin
WorkDoneProgressBegin (AString "begin"
 -> Text
 -> Maybe Bool
 -> Maybe Text
 -> Maybe UInt
 -> WorkDoneProgressBegin)
-> Parser (AString "begin")
-> Parser
     (Text
      -> Maybe Bool -> Maybe Text -> Maybe UInt -> WorkDoneProgressBegin)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg Object -> Key -> Parser (AString "begin")
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"kind" Parser
  (Text
   -> Maybe Bool -> Maybe Text -> Maybe UInt -> WorkDoneProgressBegin)
-> Parser Text
-> Parser
     (Maybe Bool -> Maybe Text -> Maybe UInt -> WorkDoneProgressBegin)
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
"title" Parser
  (Maybe Bool -> Maybe Text -> Maybe UInt -> WorkDoneProgressBegin)
-> Parser (Maybe Bool)
-> Parser (Maybe Text -> Maybe UInt -> WorkDoneProgressBegin)
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 Bool)
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"cancellable" Parser (Maybe Text -> Maybe UInt -> WorkDoneProgressBegin)
-> Parser (Maybe Text)
-> Parser (Maybe UInt -> WorkDoneProgressBegin)
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 Text)
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"message" Parser (Maybe UInt -> WorkDoneProgressBegin)
-> Parser (Maybe UInt) -> Parser WorkDoneProgressBegin
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 UInt)
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"percentage"