{- 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.ColorPresentation 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.Internal.Types.TextEdit
import qualified Language.LSP.Protocol.Types.Common

{-|

-}
data ColorPresentation = ColorPresentation 
  { {-|
  The label of this color presentation. It will be shown on the color
  picker header. By default this is also the text that is inserted when selecting
  this color presentation.
  -}
  ColorPresentation -> Text
_label :: Data.Text.Text
  , {-|
  An `TextEdit` which is applied to a document when selecting
  this presentation for the color.  When `falsy` the `ColorPresentation.label`
  is used.
  -}
  ColorPresentation -> Maybe TextEdit
_textEdit :: (Maybe Language.LSP.Protocol.Internal.Types.TextEdit.TextEdit)
  , {-|
  An optional array of additional `TextEdit` that are applied when
  selecting this color presentation. Edits must not overlap with the main `ColorPresentation.textEdit` nor with themselves.
  -}
  ColorPresentation -> Maybe [TextEdit]
_additionalTextEdits :: (Maybe [Language.LSP.Protocol.Internal.Types.TextEdit.TextEdit])
  }
  deriving stock (Int -> ColorPresentation -> ShowS
[ColorPresentation] -> ShowS
ColorPresentation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ColorPresentation] -> ShowS
$cshowList :: [ColorPresentation] -> ShowS
show :: ColorPresentation -> String
$cshow :: ColorPresentation -> String
showsPrec :: Int -> ColorPresentation -> ShowS
$cshowsPrec :: Int -> ColorPresentation -> ShowS
Show, ColorPresentation -> ColorPresentation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ColorPresentation -> ColorPresentation -> Bool
$c/= :: ColorPresentation -> ColorPresentation -> Bool
== :: ColorPresentation -> ColorPresentation -> Bool
$c== :: ColorPresentation -> ColorPresentation -> Bool
Eq, Eq ColorPresentation
ColorPresentation -> ColorPresentation -> Bool
ColorPresentation -> ColorPresentation -> Ordering
ColorPresentation -> ColorPresentation -> ColorPresentation
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 :: ColorPresentation -> ColorPresentation -> ColorPresentation
$cmin :: ColorPresentation -> ColorPresentation -> ColorPresentation
max :: ColorPresentation -> ColorPresentation -> ColorPresentation
$cmax :: ColorPresentation -> ColorPresentation -> ColorPresentation
>= :: ColorPresentation -> ColorPresentation -> Bool
$c>= :: ColorPresentation -> ColorPresentation -> Bool
> :: ColorPresentation -> ColorPresentation -> Bool
$c> :: ColorPresentation -> ColorPresentation -> Bool
<= :: ColorPresentation -> ColorPresentation -> Bool
$c<= :: ColorPresentation -> ColorPresentation -> Bool
< :: ColorPresentation -> ColorPresentation -> Bool
$c< :: ColorPresentation -> ColorPresentation -> Bool
compare :: ColorPresentation -> ColorPresentation -> Ordering
$ccompare :: ColorPresentation -> ColorPresentation -> Ordering
Ord, forall x. Rep ColorPresentation x -> ColorPresentation
forall x. ColorPresentation -> Rep ColorPresentation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ColorPresentation x -> ColorPresentation
$cfrom :: forall x. ColorPresentation -> Rep ColorPresentation x
Generic)
  deriving anyclass (ColorPresentation -> ()
forall a. (a -> ()) -> NFData a
rnf :: ColorPresentation -> ()
$crnf :: ColorPresentation -> ()
NFData, Eq ColorPresentation
Int -> ColorPresentation -> Int
ColorPresentation -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: ColorPresentation -> Int
$chash :: ColorPresentation -> Int
hashWithSalt :: Int -> ColorPresentation -> Int
$chashWithSalt :: Int -> ColorPresentation -> Int
Hashable)
  deriving forall ann. [ColorPresentation] -> Doc ann
forall ann. ColorPresentation -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [ColorPresentation] -> Doc ann
$cprettyList :: forall ann. [ColorPresentation] -> Doc ann
pretty :: forall ann. ColorPresentation -> Doc ann
$cpretty :: forall ann. ColorPresentation -> Doc ann
Pretty via (ViaJSON ColorPresentation)

instance Aeson.ToJSON ColorPresentation where
  toJSON :: ColorPresentation -> Value
toJSON (ColorPresentation Text
arg0 Maybe TextEdit
arg1 Maybe [TextEdit]
arg2) = [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
"label" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Text
arg0]
    ,String
"textEdit" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe TextEdit
arg1
    ,String
"additionalTextEdits" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe [TextEdit]
arg2]

instance Aeson.FromJSON ColorPresentation where
  parseJSON :: Value -> Parser ColorPresentation
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"ColorPresentation" forall a b. (a -> b) -> a -> b
$ \Object
arg -> Text -> Maybe TextEdit -> Maybe [TextEdit] -> ColorPresentation
ColorPresentation forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"label" forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
arg forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Aeson..:! Key
"textEdit" forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
arg forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Aeson..:! Key
"additionalTextEdits"