{- 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.Diagnostic where

import Control.DeepSeq
import Data.Hashable
import GHC.Generics
import Language.LSP.Protocol.Utils.Misc
import Prettyprinter
import qualified Data.Aeson
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.CodeDescription
import qualified Language.LSP.Protocol.Internal.Types.DiagnosticRelatedInformation
import qualified Language.LSP.Protocol.Internal.Types.DiagnosticSeverity
import qualified Language.LSP.Protocol.Internal.Types.DiagnosticTag
import qualified Language.LSP.Protocol.Internal.Types.Range
import qualified Language.LSP.Protocol.Types.Common

{-|
Represents a diagnostic, such as a compiler error or warning. Diagnostic objects
are only valid in the scope of a resource.
-}
data Diagnostic = Diagnostic 
  { {-|
  The range at which the message applies
  -}
  Diagnostic -> Range
_range :: Language.LSP.Protocol.Internal.Types.Range.Range
  , {-|
  The diagnostic's severity. Can be omitted. If omitted it is up to the
  client to interpret diagnostics as error, warning, info or hint.
  -}
  Diagnostic -> Maybe DiagnosticSeverity
_severity :: (Maybe Language.LSP.Protocol.Internal.Types.DiagnosticSeverity.DiagnosticSeverity)
  , {-|
  The diagnostic's code, which usually appear in the user interface.
  -}
  Diagnostic -> Maybe (Int32 |? Text)
_code :: (Maybe (Language.LSP.Protocol.Types.Common.Int32 Language.LSP.Protocol.Types.Common.|? Data.Text.Text))
  , {-|
  An optional property to describe the error code.
  Requires the code field (above) to be present/not null.

  @since 3.16.0
  -}
  Diagnostic -> Maybe CodeDescription
_codeDescription :: (Maybe Language.LSP.Protocol.Internal.Types.CodeDescription.CodeDescription)
  , {-|
  A human-readable string describing the source of this
  diagnostic, e.g. 'typescript' or 'super lint'. It usually
  appears in the user interface.
  -}
  Diagnostic -> Maybe Text
_source :: (Maybe Data.Text.Text)
  , {-|
  The diagnostic's message. It usually appears in the user interface
  -}
  Diagnostic -> Text
_message :: Data.Text.Text
  , {-|
  Additional metadata about the diagnostic.

  @since 3.15.0
  -}
  Diagnostic -> Maybe [DiagnosticTag]
_tags :: (Maybe [Language.LSP.Protocol.Internal.Types.DiagnosticTag.DiagnosticTag])
  , {-|
  An array of related diagnostic information, e.g. when symbol-names within
  a scope collide all definitions can be marked via this property.
  -}
  Diagnostic -> Maybe [DiagnosticRelatedInformation]
_relatedInformation :: (Maybe [Language.LSP.Protocol.Internal.Types.DiagnosticRelatedInformation.DiagnosticRelatedInformation])
  , {-|
  A data entry field that is preserved between a `textDocument/publishDiagnostics`
  notification and `textDocument/codeAction` request.

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

instance Aeson.ToJSON Diagnostic where
  toJSON :: Diagnostic -> Value
toJSON (Diagnostic Range
arg0 Maybe DiagnosticSeverity
arg1 Maybe (Int32 |? Text)
arg2 Maybe CodeDescription
arg3 Maybe Text
arg4 Text
arg5 Maybe [DiagnosticTag]
arg6 Maybe [DiagnosticRelatedInformation]
arg7 Maybe Value
arg8) = [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]
    ,String
"severity" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe DiagnosticSeverity
arg1
    ,String
"code" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe (Int32 |? Text)
arg2
    ,String
"codeDescription" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe CodeDescription
arg3
    ,String
"source" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Text
arg4
    ,[Key
"message" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Text
arg5]
    ,String
"tags" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe [DiagnosticTag]
arg6
    ,String
"relatedInformation" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe [DiagnosticRelatedInformation]
arg7
    ,String
"data" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Value
arg8]

instance Aeson.FromJSON Diagnostic where
  parseJSON :: Value -> Parser Diagnostic
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"Diagnostic" forall a b. (a -> b) -> a -> b
$ \Object
arg -> Range
-> Maybe DiagnosticSeverity
-> Maybe (Int32 |? Text)
-> Maybe CodeDescription
-> Maybe Text
-> Text
-> Maybe [DiagnosticTag]
-> Maybe [DiagnosticRelatedInformation]
-> Maybe Value
-> Diagnostic
Diagnostic 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 (Maybe a)
Aeson..:! Key
"severity" 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
"code" 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
"codeDescription" 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
"source" 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
"message" 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
"tags" 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
"relatedInformation" 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
"data"