{- 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.ColorPresentationParams 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 Language.LSP.Protocol.Internal.Types.Color
import qualified Language.LSP.Protocol.Internal.Types.ProgressToken
import qualified Language.LSP.Protocol.Internal.Types.Range
import qualified Language.LSP.Protocol.Internal.Types.TextDocumentIdentifier
import qualified Language.LSP.Protocol.Types.Common

{-|
Parameters for a `ColorPresentationRequest`.
-}
data ColorPresentationParams = ColorPresentationParams 
  { {-|
  An optional token that a server can use to report work done progress.
  -}
  ColorPresentationParams -> Maybe ProgressToken
_workDoneToken :: (Maybe Language.LSP.Protocol.Internal.Types.ProgressToken.ProgressToken)
  , {-|
  An optional token that a server can use to report partial results (e.g. streaming) to
  the client.
  -}
  ColorPresentationParams -> Maybe ProgressToken
_partialResultToken :: (Maybe Language.LSP.Protocol.Internal.Types.ProgressToken.ProgressToken)
  , {-|
  The text document.
  -}
  ColorPresentationParams -> TextDocumentIdentifier
_textDocument :: Language.LSP.Protocol.Internal.Types.TextDocumentIdentifier.TextDocumentIdentifier
  , {-|
  The color to request presentations for.
  -}
  ColorPresentationParams -> Color
_color :: Language.LSP.Protocol.Internal.Types.Color.Color
  , {-|
  The range where the color would be inserted. Serves as a context.
  -}
  ColorPresentationParams -> Range
_range :: Language.LSP.Protocol.Internal.Types.Range.Range
  }
  deriving stock (Int -> ColorPresentationParams -> ShowS
[ColorPresentationParams] -> ShowS
ColorPresentationParams -> String
(Int -> ColorPresentationParams -> ShowS)
-> (ColorPresentationParams -> String)
-> ([ColorPresentationParams] -> ShowS)
-> Show ColorPresentationParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ColorPresentationParams -> ShowS
showsPrec :: Int -> ColorPresentationParams -> ShowS
$cshow :: ColorPresentationParams -> String
show :: ColorPresentationParams -> String
$cshowList :: [ColorPresentationParams] -> ShowS
showList :: [ColorPresentationParams] -> ShowS
Show, ColorPresentationParams -> ColorPresentationParams -> Bool
(ColorPresentationParams -> ColorPresentationParams -> Bool)
-> (ColorPresentationParams -> ColorPresentationParams -> Bool)
-> Eq ColorPresentationParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ColorPresentationParams -> ColorPresentationParams -> Bool
== :: ColorPresentationParams -> ColorPresentationParams -> Bool
$c/= :: ColorPresentationParams -> ColorPresentationParams -> Bool
/= :: ColorPresentationParams -> ColorPresentationParams -> Bool
Eq, Eq ColorPresentationParams
Eq ColorPresentationParams =>
(ColorPresentationParams -> ColorPresentationParams -> Ordering)
-> (ColorPresentationParams -> ColorPresentationParams -> Bool)
-> (ColorPresentationParams -> ColorPresentationParams -> Bool)
-> (ColorPresentationParams -> ColorPresentationParams -> Bool)
-> (ColorPresentationParams -> ColorPresentationParams -> Bool)
-> (ColorPresentationParams
    -> ColorPresentationParams -> ColorPresentationParams)
-> (ColorPresentationParams
    -> ColorPresentationParams -> ColorPresentationParams)
-> Ord ColorPresentationParams
ColorPresentationParams -> ColorPresentationParams -> Bool
ColorPresentationParams -> ColorPresentationParams -> Ordering
ColorPresentationParams
-> ColorPresentationParams -> ColorPresentationParams
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 :: ColorPresentationParams -> ColorPresentationParams -> Ordering
compare :: ColorPresentationParams -> ColorPresentationParams -> Ordering
$c< :: ColorPresentationParams -> ColorPresentationParams -> Bool
< :: ColorPresentationParams -> ColorPresentationParams -> Bool
$c<= :: ColorPresentationParams -> ColorPresentationParams -> Bool
<= :: ColorPresentationParams -> ColorPresentationParams -> Bool
$c> :: ColorPresentationParams -> ColorPresentationParams -> Bool
> :: ColorPresentationParams -> ColorPresentationParams -> Bool
$c>= :: ColorPresentationParams -> ColorPresentationParams -> Bool
>= :: ColorPresentationParams -> ColorPresentationParams -> Bool
$cmax :: ColorPresentationParams
-> ColorPresentationParams -> ColorPresentationParams
max :: ColorPresentationParams
-> ColorPresentationParams -> ColorPresentationParams
$cmin :: ColorPresentationParams
-> ColorPresentationParams -> ColorPresentationParams
min :: ColorPresentationParams
-> ColorPresentationParams -> ColorPresentationParams
Ord, (forall x.
 ColorPresentationParams -> Rep ColorPresentationParams x)
-> (forall x.
    Rep ColorPresentationParams x -> ColorPresentationParams)
-> Generic ColorPresentationParams
forall x. Rep ColorPresentationParams x -> ColorPresentationParams
forall x. ColorPresentationParams -> Rep ColorPresentationParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ColorPresentationParams -> Rep ColorPresentationParams x
from :: forall x. ColorPresentationParams -> Rep ColorPresentationParams x
$cto :: forall x. Rep ColorPresentationParams x -> ColorPresentationParams
to :: forall x. Rep ColorPresentationParams x -> ColorPresentationParams
Generic)
  deriving anyclass (ColorPresentationParams -> ()
(ColorPresentationParams -> ()) -> NFData ColorPresentationParams
forall a. (a -> ()) -> NFData a
$crnf :: ColorPresentationParams -> ()
rnf :: ColorPresentationParams -> ()
NFData, Eq ColorPresentationParams
Eq ColorPresentationParams =>
(Int -> ColorPresentationParams -> Int)
-> (ColorPresentationParams -> Int)
-> Hashable ColorPresentationParams
Int -> ColorPresentationParams -> Int
ColorPresentationParams -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> ColorPresentationParams -> Int
hashWithSalt :: Int -> ColorPresentationParams -> Int
$chash :: ColorPresentationParams -> Int
hash :: ColorPresentationParams -> Int
Hashable)
  deriving (forall ann. ColorPresentationParams -> Doc ann)
-> (forall ann. [ColorPresentationParams] -> Doc ann)
-> Pretty ColorPresentationParams
forall ann. [ColorPresentationParams] -> Doc ann
forall ann. ColorPresentationParams -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
$cpretty :: forall ann. ColorPresentationParams -> Doc ann
pretty :: forall ann. ColorPresentationParams -> Doc ann
$cprettyList :: forall ann. [ColorPresentationParams] -> Doc ann
prettyList :: forall ann. [ColorPresentationParams] -> Doc ann
Pretty via (ViaJSON ColorPresentationParams)

instance Aeson.ToJSON ColorPresentationParams where
  toJSON :: ColorPresentationParams -> Value
toJSON (ColorPresentationParams Maybe ProgressToken
arg0 Maybe ProgressToken
arg1 TextDocumentIdentifier
arg2 Color
arg3 Range
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
$  [String
"workDoneToken" String -> Maybe ProgressToken -> [Pair]
forall e kv v.
(KeyValue e kv, ToJSON v) =>
String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe ProgressToken
arg0
    ,String
"partialResultToken" String -> Maybe ProgressToken -> [Pair]
forall e kv v.
(KeyValue e kv, ToJSON v) =>
String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe ProgressToken
arg1
    ,[Key
"textDocument" Key -> TextDocumentIdentifier -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= TextDocumentIdentifier
arg2]
    ,[Key
"color" Key -> Color -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= Color
arg3]
    ,[Key
"range" Key -> Range -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= Range
arg4]]

instance Aeson.FromJSON ColorPresentationParams where
  parseJSON :: Value -> Parser ColorPresentationParams
parseJSON = String
-> (Object -> Parser ColorPresentationParams)
-> Value
-> Parser ColorPresentationParams
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"ColorPresentationParams" ((Object -> Parser ColorPresentationParams)
 -> Value -> Parser ColorPresentationParams)
-> (Object -> Parser ColorPresentationParams)
-> Value
-> Parser ColorPresentationParams
forall a b. (a -> b) -> a -> b
$ \Object
arg -> Maybe ProgressToken
-> Maybe ProgressToken
-> TextDocumentIdentifier
-> Color
-> Range
-> ColorPresentationParams
ColorPresentationParams (Maybe ProgressToken
 -> Maybe ProgressToken
 -> TextDocumentIdentifier
 -> Color
 -> Range
 -> ColorPresentationParams)
-> Parser (Maybe ProgressToken)
-> Parser
     (Maybe ProgressToken
      -> TextDocumentIdentifier
      -> Color
      -> Range
      -> ColorPresentationParams)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg Object -> Key -> Parser (Maybe ProgressToken)
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"workDoneToken" Parser
  (Maybe ProgressToken
   -> TextDocumentIdentifier
   -> Color
   -> Range
   -> ColorPresentationParams)
-> Parser (Maybe ProgressToken)
-> Parser
     (TextDocumentIdentifier
      -> Color -> Range -> ColorPresentationParams)
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 ProgressToken)
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"partialResultToken" Parser
  (TextDocumentIdentifier
   -> Color -> Range -> ColorPresentationParams)
-> Parser TextDocumentIdentifier
-> Parser (Color -> Range -> ColorPresentationParams)
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 TextDocumentIdentifier
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"textDocument" Parser (Color -> Range -> ColorPresentationParams)
-> Parser Color -> Parser (Range -> ColorPresentationParams)
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 Color
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"color" Parser (Range -> ColorPresentationParams)
-> Parser Range -> Parser ColorPresentationParams
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 Range
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"range"