-- 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.CodeDescription where

import Control.DeepSeq
import Data.Hashable
import GHC.Generics
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.Types.Common
import qualified Language.LSP.Protocol.Types.Uri

{-|
Structure to capture a description for an error code.

@since 3.16.0
-}
data CodeDescription = CodeDescription 
  { {-|
  An URI to open with more information about the diagnostic error.
  -}
  CodeDescription -> Uri
_href :: Language.LSP.Protocol.Types.Uri.Uri
  }
  deriving stock (Int -> CodeDescription -> ShowS
[CodeDescription] -> ShowS
CodeDescription -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CodeDescription] -> ShowS
$cshowList :: [CodeDescription] -> ShowS
show :: CodeDescription -> String
$cshow :: CodeDescription -> String
showsPrec :: Int -> CodeDescription -> ShowS
$cshowsPrec :: Int -> CodeDescription -> ShowS
Show, CodeDescription -> CodeDescription -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CodeDescription -> CodeDescription -> Bool
$c/= :: CodeDescription -> CodeDescription -> Bool
== :: CodeDescription -> CodeDescription -> Bool
$c== :: CodeDescription -> CodeDescription -> Bool
Eq, Eq CodeDescription
CodeDescription -> CodeDescription -> Bool
CodeDescription -> CodeDescription -> Ordering
CodeDescription -> CodeDescription -> CodeDescription
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 :: CodeDescription -> CodeDescription -> CodeDescription
$cmin :: CodeDescription -> CodeDescription -> CodeDescription
max :: CodeDescription -> CodeDescription -> CodeDescription
$cmax :: CodeDescription -> CodeDescription -> CodeDescription
>= :: CodeDescription -> CodeDescription -> Bool
$c>= :: CodeDescription -> CodeDescription -> Bool
> :: CodeDescription -> CodeDescription -> Bool
$c> :: CodeDescription -> CodeDescription -> Bool
<= :: CodeDescription -> CodeDescription -> Bool
$c<= :: CodeDescription -> CodeDescription -> Bool
< :: CodeDescription -> CodeDescription -> Bool
$c< :: CodeDescription -> CodeDescription -> Bool
compare :: CodeDescription -> CodeDescription -> Ordering
$ccompare :: CodeDescription -> CodeDescription -> Ordering
Ord, forall x. Rep CodeDescription x -> CodeDescription
forall x. CodeDescription -> Rep CodeDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CodeDescription x -> CodeDescription
$cfrom :: forall x. CodeDescription -> Rep CodeDescription x
Generic)
  deriving anyclass (CodeDescription -> ()
forall a. (a -> ()) -> NFData a
rnf :: CodeDescription -> ()
$crnf :: CodeDescription -> ()
NFData, Eq CodeDescription
Int -> CodeDescription -> Int
CodeDescription -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: CodeDescription -> Int
$chash :: CodeDescription -> Int
hashWithSalt :: Int -> CodeDescription -> Int
$chashWithSalt :: Int -> CodeDescription -> Int
Hashable)

instance Aeson.ToJSON CodeDescription where
  toJSON :: CodeDescription -> Value
toJSON (CodeDescription Uri
arg0) = [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
"href" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Uri
arg0]]

instance Aeson.FromJSON CodeDescription where
  parseJSON :: Value -> Parser CodeDescription
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"CodeDescription" forall a b. (a -> b) -> a -> b
$ \Object
arg -> Uri -> CodeDescription
CodeDescription forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"href"