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

{-|
Represents a related message and source code location for a diagnostic. This should be
used to point to code locations that cause or related to a diagnostics, e.g when duplicating
a symbol in a scope.
-}
data DiagnosticRelatedInformation = DiagnosticRelatedInformation 
  { {-|
  The location of this related diagnostic information.
  -}
  DiagnosticRelatedInformation -> Location
_location :: Language.LSP.Protocol.Internal.Types.Location.Location
  , {-|
  The message of this related diagnostic information.
  -}
  DiagnosticRelatedInformation -> Text
_message :: Data.Text.Text
  }
  deriving stock (Int -> DiagnosticRelatedInformation -> ShowS
[DiagnosticRelatedInformation] -> ShowS
DiagnosticRelatedInformation -> String
(Int -> DiagnosticRelatedInformation -> ShowS)
-> (DiagnosticRelatedInformation -> String)
-> ([DiagnosticRelatedInformation] -> ShowS)
-> Show DiagnosticRelatedInformation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DiagnosticRelatedInformation -> ShowS
showsPrec :: Int -> DiagnosticRelatedInformation -> ShowS
$cshow :: DiagnosticRelatedInformation -> String
show :: DiagnosticRelatedInformation -> String
$cshowList :: [DiagnosticRelatedInformation] -> ShowS
showList :: [DiagnosticRelatedInformation] -> ShowS
Show, DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> Bool
(DiagnosticRelatedInformation
 -> DiagnosticRelatedInformation -> Bool)
-> (DiagnosticRelatedInformation
    -> DiagnosticRelatedInformation -> Bool)
-> Eq DiagnosticRelatedInformation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> Bool
== :: DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> Bool
$c/= :: DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> Bool
/= :: DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> Bool
Eq, Eq DiagnosticRelatedInformation
Eq DiagnosticRelatedInformation =>
(DiagnosticRelatedInformation
 -> DiagnosticRelatedInformation -> Ordering)
-> (DiagnosticRelatedInformation
    -> DiagnosticRelatedInformation -> Bool)
-> (DiagnosticRelatedInformation
    -> DiagnosticRelatedInformation -> Bool)
-> (DiagnosticRelatedInformation
    -> DiagnosticRelatedInformation -> Bool)
-> (DiagnosticRelatedInformation
    -> DiagnosticRelatedInformation -> Bool)
-> (DiagnosticRelatedInformation
    -> DiagnosticRelatedInformation -> DiagnosticRelatedInformation)
-> (DiagnosticRelatedInformation
    -> DiagnosticRelatedInformation -> DiagnosticRelatedInformation)
-> Ord DiagnosticRelatedInformation
DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> Bool
DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> Ordering
DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> DiagnosticRelatedInformation
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 :: DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> Ordering
compare :: DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> Ordering
$c< :: DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> Bool
< :: DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> Bool
$c<= :: DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> Bool
<= :: DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> Bool
$c> :: DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> Bool
> :: DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> Bool
$c>= :: DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> Bool
>= :: DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> Bool
$cmax :: DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> DiagnosticRelatedInformation
max :: DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> DiagnosticRelatedInformation
$cmin :: DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> DiagnosticRelatedInformation
min :: DiagnosticRelatedInformation
-> DiagnosticRelatedInformation -> DiagnosticRelatedInformation
Ord, (forall x.
 DiagnosticRelatedInformation -> Rep DiagnosticRelatedInformation x)
-> (forall x.
    Rep DiagnosticRelatedInformation x -> DiagnosticRelatedInformation)
-> Generic DiagnosticRelatedInformation
forall x.
Rep DiagnosticRelatedInformation x -> DiagnosticRelatedInformation
forall x.
DiagnosticRelatedInformation -> Rep DiagnosticRelatedInformation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x.
DiagnosticRelatedInformation -> Rep DiagnosticRelatedInformation x
from :: forall x.
DiagnosticRelatedInformation -> Rep DiagnosticRelatedInformation x
$cto :: forall x.
Rep DiagnosticRelatedInformation x -> DiagnosticRelatedInformation
to :: forall x.
Rep DiagnosticRelatedInformation x -> DiagnosticRelatedInformation
Generic)
  deriving anyclass (DiagnosticRelatedInformation -> ()
(DiagnosticRelatedInformation -> ())
-> NFData DiagnosticRelatedInformation
forall a. (a -> ()) -> NFData a
$crnf :: DiagnosticRelatedInformation -> ()
rnf :: DiagnosticRelatedInformation -> ()
NFData, Eq DiagnosticRelatedInformation
Eq DiagnosticRelatedInformation =>
(Int -> DiagnosticRelatedInformation -> Int)
-> (DiagnosticRelatedInformation -> Int)
-> Hashable DiagnosticRelatedInformation
Int -> DiagnosticRelatedInformation -> Int
DiagnosticRelatedInformation -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> DiagnosticRelatedInformation -> Int
hashWithSalt :: Int -> DiagnosticRelatedInformation -> Int
$chash :: DiagnosticRelatedInformation -> Int
hash :: DiagnosticRelatedInformation -> Int
Hashable)
  deriving (forall ann. DiagnosticRelatedInformation -> Doc ann)
-> (forall ann. [DiagnosticRelatedInformation] -> Doc ann)
-> Pretty DiagnosticRelatedInformation
forall ann. [DiagnosticRelatedInformation] -> Doc ann
forall ann. DiagnosticRelatedInformation -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
$cpretty :: forall ann. DiagnosticRelatedInformation -> Doc ann
pretty :: forall ann. DiagnosticRelatedInformation -> Doc ann
$cprettyList :: forall ann. [DiagnosticRelatedInformation] -> Doc ann
prettyList :: forall ann. [DiagnosticRelatedInformation] -> Doc ann
Pretty via (ViaJSON DiagnosticRelatedInformation)

instance Aeson.ToJSON DiagnosticRelatedInformation where
  toJSON :: DiagnosticRelatedInformation -> Value
toJSON (DiagnosticRelatedInformation Location
arg0 Text
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
"location" Key -> Location -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= Location
arg0]
    ,[Key
"message" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= Text
arg1]]

instance Aeson.FromJSON DiagnosticRelatedInformation where
  parseJSON :: Value -> Parser DiagnosticRelatedInformation
parseJSON = String
-> (Object -> Parser DiagnosticRelatedInformation)
-> Value
-> Parser DiagnosticRelatedInformation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"DiagnosticRelatedInformation" ((Object -> Parser DiagnosticRelatedInformation)
 -> Value -> Parser DiagnosticRelatedInformation)
-> (Object -> Parser DiagnosticRelatedInformation)
-> Value
-> Parser DiagnosticRelatedInformation
forall a b. (a -> b) -> a -> b
$ \Object
arg -> Location -> Text -> DiagnosticRelatedInformation
DiagnosticRelatedInformation (Location -> Text -> DiagnosticRelatedInformation)
-> Parser Location -> Parser (Text -> DiagnosticRelatedInformation)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg Object -> Key -> Parser Location
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"location" Parser (Text -> DiagnosticRelatedInformation)
-> Parser Text -> Parser DiagnosticRelatedInformation
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 Text
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"message"