module Language.LSP.Protocol.Types.Progress (
  _workDoneProgressBegin,
  _workDoneProgressEnd,
  _workDoneProgressReport,
)
where

import Control.Lens
import Data.Aeson

import Language.LSP.Protocol.Internal.Types.WorkDoneProgressBegin
import Language.LSP.Protocol.Internal.Types.WorkDoneProgressEnd
import Language.LSP.Protocol.Internal.Types.WorkDoneProgressReport

-- From lens-aeson
_JSON :: (ToJSON a, FromJSON a) => Prism' Value a
_JSON :: forall a. (ToJSON a, FromJSON a) => Prism' Value a
_JSON = forall b t s a. (b -> t) -> (s -> Either t a) -> Prism s t a b
prism forall a. ToJSON a => a -> Value
toJSON forall a b. (a -> b) -> a -> b
$ \Value
x -> case forall a. FromJSON a => Value -> Result a
fromJSON Value
x of
  Success a
y -> forall a b. b -> Either a b
Right a
y
  Result a
_ -> forall a b. a -> Either a b
Left Value
x

-- | Prism for extracting the 'WorkDoneProgressBegin' case from the unstructured 'value' field of 'ProgressParams'.
_workDoneProgressBegin :: Prism' Value WorkDoneProgressBegin
_workDoneProgressBegin :: Prism' Value WorkDoneProgressBegin
_workDoneProgressBegin = forall a. (ToJSON a, FromJSON a) => Prism' Value a
_JSON

-- | Prism for extracting the 'WorkDoneProgressEnd' case from the unstructured 'value' field of 'ProgressParams'.
_workDoneProgressEnd :: Prism' Value WorkDoneProgressEnd
_workDoneProgressEnd :: Prism' Value WorkDoneProgressEnd
_workDoneProgressEnd = forall a. (ToJSON a, FromJSON a) => Prism' Value a
_JSON

-- | Prism for extracting the 'WorkDoneProgressReport' case from the unstructured 'value' field of 'ProgressParams'.
_workDoneProgressReport :: Prism' Value WorkDoneProgressReport
_workDoneProgressReport :: Prism' Value WorkDoneProgressReport
_workDoneProgressReport = forall a. (ToJSON a, FromJSON a) => Prism' Value a
_JSON