{- 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.ColorInformation 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.Range
import qualified Language.LSP.Protocol.Types.Common

{-|
Represents a color range from a document.
-}
data ColorInformation = ColorInformation 
  { {-|
  The range in the document where this color appears.
  -}
  ColorInformation -> Range
_range :: Language.LSP.Protocol.Internal.Types.Range.Range
  , {-|
  The actual color value for this color range.
  -}
  ColorInformation -> Color
_color :: Language.LSP.Protocol.Internal.Types.Color.Color
  }
  deriving stock (Int -> ColorInformation -> ShowS
[ColorInformation] -> ShowS
ColorInformation -> String
(Int -> ColorInformation -> ShowS)
-> (ColorInformation -> String)
-> ([ColorInformation] -> ShowS)
-> Show ColorInformation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ColorInformation -> ShowS
showsPrec :: Int -> ColorInformation -> ShowS
$cshow :: ColorInformation -> String
show :: ColorInformation -> String
$cshowList :: [ColorInformation] -> ShowS
showList :: [ColorInformation] -> ShowS
Show, ColorInformation -> ColorInformation -> Bool
(ColorInformation -> ColorInformation -> Bool)
-> (ColorInformation -> ColorInformation -> Bool)
-> Eq ColorInformation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ColorInformation -> ColorInformation -> Bool
== :: ColorInformation -> ColorInformation -> Bool
$c/= :: ColorInformation -> ColorInformation -> Bool
/= :: ColorInformation -> ColorInformation -> Bool
Eq, Eq ColorInformation
Eq ColorInformation =>
(ColorInformation -> ColorInformation -> Ordering)
-> (ColorInformation -> ColorInformation -> Bool)
-> (ColorInformation -> ColorInformation -> Bool)
-> (ColorInformation -> ColorInformation -> Bool)
-> (ColorInformation -> ColorInformation -> Bool)
-> (ColorInformation -> ColorInformation -> ColorInformation)
-> (ColorInformation -> ColorInformation -> ColorInformation)
-> Ord ColorInformation
ColorInformation -> ColorInformation -> Bool
ColorInformation -> ColorInformation -> Ordering
ColorInformation -> ColorInformation -> ColorInformation
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 :: ColorInformation -> ColorInformation -> Ordering
compare :: ColorInformation -> ColorInformation -> Ordering
$c< :: ColorInformation -> ColorInformation -> Bool
< :: ColorInformation -> ColorInformation -> Bool
$c<= :: ColorInformation -> ColorInformation -> Bool
<= :: ColorInformation -> ColorInformation -> Bool
$c> :: ColorInformation -> ColorInformation -> Bool
> :: ColorInformation -> ColorInformation -> Bool
$c>= :: ColorInformation -> ColorInformation -> Bool
>= :: ColorInformation -> ColorInformation -> Bool
$cmax :: ColorInformation -> ColorInformation -> ColorInformation
max :: ColorInformation -> ColorInformation -> ColorInformation
$cmin :: ColorInformation -> ColorInformation -> ColorInformation
min :: ColorInformation -> ColorInformation -> ColorInformation
Ord, (forall x. ColorInformation -> Rep ColorInformation x)
-> (forall x. Rep ColorInformation x -> ColorInformation)
-> Generic ColorInformation
forall x. Rep ColorInformation x -> ColorInformation
forall x. ColorInformation -> Rep ColorInformation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ColorInformation -> Rep ColorInformation x
from :: forall x. ColorInformation -> Rep ColorInformation x
$cto :: forall x. Rep ColorInformation x -> ColorInformation
to :: forall x. Rep ColorInformation x -> ColorInformation
Generic)
  deriving anyclass (ColorInformation -> ()
(ColorInformation -> ()) -> NFData ColorInformation
forall a. (a -> ()) -> NFData a
$crnf :: ColorInformation -> ()
rnf :: ColorInformation -> ()
NFData, Eq ColorInformation
Eq ColorInformation =>
(Int -> ColorInformation -> Int)
-> (ColorInformation -> Int) -> Hashable ColorInformation
Int -> ColorInformation -> Int
ColorInformation -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> ColorInformation -> Int
hashWithSalt :: Int -> ColorInformation -> Int
$chash :: ColorInformation -> Int
hash :: ColorInformation -> Int
Hashable)
  deriving (forall ann. ColorInformation -> Doc ann)
-> (forall ann. [ColorInformation] -> Doc ann)
-> Pretty ColorInformation
forall ann. [ColorInformation] -> Doc ann
forall ann. ColorInformation -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
$cpretty :: forall ann. ColorInformation -> Doc ann
pretty :: forall ann. ColorInformation -> Doc ann
$cprettyList :: forall ann. [ColorInformation] -> Doc ann
prettyList :: forall ann. [ColorInformation] -> Doc ann
Pretty via (ViaJSON ColorInformation)

instance Aeson.ToJSON ColorInformation where
  toJSON :: ColorInformation -> Value
toJSON (ColorInformation Range
arg0 Color
arg1) = [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
"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
arg0]
    ,[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
arg1]]

instance Aeson.FromJSON ColorInformation where
  parseJSON :: Value -> Parser ColorInformation
parseJSON = String
-> (Object -> Parser ColorInformation)
-> Value
-> Parser ColorInformation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"ColorInformation" ((Object -> Parser ColorInformation)
 -> Value -> Parser ColorInformation)
-> (Object -> Parser ColorInformation)
-> Value
-> Parser ColorInformation
forall a b. (a -> b) -> a -> b
$ \Object
arg -> Range -> Color -> ColorInformation
ColorInformation (Range -> Color -> ColorInformation)
-> Parser Range -> Parser (Color -> ColorInformation)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg Object -> Key -> Parser Range
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"range" Parser (Color -> ColorInformation)
-> Parser Color -> Parser ColorInformation
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"