{- 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.CodeDescription 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.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
(Int -> CodeDescription -> ShowS)
-> (CodeDescription -> String)
-> ([CodeDescription] -> ShowS)
-> Show CodeDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CodeDescription -> ShowS
showsPrec :: Int -> CodeDescription -> ShowS
$cshow :: CodeDescription -> String
show :: CodeDescription -> String
$cshowList :: [CodeDescription] -> ShowS
showList :: [CodeDescription] -> ShowS
Show, CodeDescription -> CodeDescription -> Bool
(CodeDescription -> CodeDescription -> Bool)
-> (CodeDescription -> CodeDescription -> Bool)
-> Eq CodeDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CodeDescription -> CodeDescription -> Bool
== :: CodeDescription -> CodeDescription -> Bool
$c/= :: CodeDescription -> CodeDescription -> Bool
/= :: CodeDescription -> CodeDescription -> Bool
Eq, Eq CodeDescription
Eq CodeDescription =>
(CodeDescription -> CodeDescription -> Ordering)
-> (CodeDescription -> CodeDescription -> Bool)
-> (CodeDescription -> CodeDescription -> Bool)
-> (CodeDescription -> CodeDescription -> Bool)
-> (CodeDescription -> CodeDescription -> Bool)
-> (CodeDescription -> CodeDescription -> CodeDescription)
-> (CodeDescription -> CodeDescription -> CodeDescription)
-> Ord 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
$ccompare :: CodeDescription -> CodeDescription -> Ordering
compare :: CodeDescription -> CodeDescription -> Ordering
$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
>= :: CodeDescription -> CodeDescription -> Bool
$cmax :: CodeDescription -> CodeDescription -> CodeDescription
max :: CodeDescription -> CodeDescription -> CodeDescription
$cmin :: CodeDescription -> CodeDescription -> CodeDescription
min :: CodeDescription -> CodeDescription -> CodeDescription
Ord, (forall x. CodeDescription -> Rep CodeDescription x)
-> (forall x. Rep CodeDescription x -> CodeDescription)
-> Generic CodeDescription
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
$cfrom :: forall x. CodeDescription -> Rep CodeDescription x
from :: forall x. CodeDescription -> Rep CodeDescription x
$cto :: forall x. Rep CodeDescription x -> CodeDescription
to :: forall x. Rep CodeDescription x -> CodeDescription
Generic)
  deriving anyclass (CodeDescription -> ()
(CodeDescription -> ()) -> NFData CodeDescription
forall a. (a -> ()) -> NFData a
$crnf :: CodeDescription -> ()
rnf :: CodeDescription -> ()
NFData, Eq CodeDescription
Eq CodeDescription =>
(Int -> CodeDescription -> Int)
-> (CodeDescription -> Int) -> Hashable CodeDescription
Int -> CodeDescription -> Int
CodeDescription -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> CodeDescription -> Int
hashWithSalt :: Int -> CodeDescription -> Int
$chash :: CodeDescription -> Int
hash :: CodeDescription -> Int
Hashable)
  deriving (forall ann. CodeDescription -> Doc ann)
-> (forall ann. [CodeDescription] -> Doc ann)
-> Pretty CodeDescription
forall ann. [CodeDescription] -> Doc ann
forall ann. CodeDescription -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
$cpretty :: forall ann. CodeDescription -> Doc ann
pretty :: forall ann. CodeDescription -> Doc ann
$cprettyList :: forall ann. [CodeDescription] -> Doc ann
prettyList :: forall ann. [CodeDescription] -> Doc ann
Pretty via (ViaJSON CodeDescription)

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

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