{- 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
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ColorInformation] -> ShowS
$cshowList :: [ColorInformation] -> ShowS
show :: ColorInformation -> String
$cshow :: ColorInformation -> String
showsPrec :: Int -> ColorInformation -> ShowS
$cshowsPrec :: Int -> ColorInformation -> ShowS
Show, ColorInformation -> ColorInformation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ColorInformation -> ColorInformation -> Bool
$c/= :: ColorInformation -> ColorInformation -> Bool
== :: ColorInformation -> ColorInformation -> Bool
$c== :: ColorInformation -> ColorInformation -> Bool
Eq, Eq 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
min :: ColorInformation -> ColorInformation -> ColorInformation
$cmin :: ColorInformation -> ColorInformation -> ColorInformation
max :: ColorInformation -> ColorInformation -> ColorInformation
$cmax :: ColorInformation -> ColorInformation -> ColorInformation
>= :: ColorInformation -> ColorInformation -> Bool
$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
compare :: ColorInformation -> ColorInformation -> Ordering
$ccompare :: ColorInformation -> ColorInformation -> Ordering
Ord, 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
$cto :: forall x. Rep ColorInformation x -> ColorInformation
$cfrom :: forall x. ColorInformation -> Rep ColorInformation x
Generic)
  deriving anyclass (ColorInformation -> ()
forall a. (a -> ()) -> NFData a
rnf :: ColorInformation -> ()
$crnf :: ColorInformation -> ()
NFData, Eq ColorInformation
Int -> ColorInformation -> Int
ColorInformation -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: ColorInformation -> Int
$chash :: ColorInformation -> Int
hashWithSalt :: Int -> ColorInformation -> Int
$chashWithSalt :: Int -> ColorInformation -> Int
Hashable)
  deriving forall ann. [ColorInformation] -> Doc ann
forall ann. ColorInformation -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [ColorInformation] -> Doc ann
$cprettyList :: forall ann. [ColorInformation] -> Doc ann
pretty :: forall ann. ColorInformation -> Doc ann
$cpretty :: 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 forall a b. (a -> b) -> a -> b
$ forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat forall a b. (a -> b) -> a -> b
$  [[Key
"range" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Range
arg0]
    ,[Key
"color" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Color
arg1]]

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