{- 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.PublishDiagnosticsParams 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.Internal.Types.Diagnostic
import qualified Language.LSP.Protocol.Types.Common
import qualified Language.LSP.Protocol.Types.Uri

{-|
The publish diagnostic notification's parameters.
-}
data PublishDiagnosticsParams = PublishDiagnosticsParams 
  { {-|
  The URI for which diagnostic information is reported.
  -}
  PublishDiagnosticsParams -> Uri
_uri :: Language.LSP.Protocol.Types.Uri.Uri
  , {-|
  Optional the version number of the document the diagnostics are published for.

  @since 3.15.0
  -}
  PublishDiagnosticsParams -> Maybe Int32
_version :: (Maybe Language.LSP.Protocol.Types.Common.Int32)
  , {-|
  An array of diagnostic information items.
  -}
  PublishDiagnosticsParams -> [Diagnostic]
_diagnostics :: [Language.LSP.Protocol.Internal.Types.Diagnostic.Diagnostic]
  }
  deriving stock (Int -> PublishDiagnosticsParams -> ShowS
[PublishDiagnosticsParams] -> ShowS
PublishDiagnosticsParams -> String
(Int -> PublishDiagnosticsParams -> ShowS)
-> (PublishDiagnosticsParams -> String)
-> ([PublishDiagnosticsParams] -> ShowS)
-> Show PublishDiagnosticsParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PublishDiagnosticsParams -> ShowS
showsPrec :: Int -> PublishDiagnosticsParams -> ShowS
$cshow :: PublishDiagnosticsParams -> String
show :: PublishDiagnosticsParams -> String
$cshowList :: [PublishDiagnosticsParams] -> ShowS
showList :: [PublishDiagnosticsParams] -> ShowS
Show, PublishDiagnosticsParams -> PublishDiagnosticsParams -> Bool
(PublishDiagnosticsParams -> PublishDiagnosticsParams -> Bool)
-> (PublishDiagnosticsParams -> PublishDiagnosticsParams -> Bool)
-> Eq PublishDiagnosticsParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PublishDiagnosticsParams -> PublishDiagnosticsParams -> Bool
== :: PublishDiagnosticsParams -> PublishDiagnosticsParams -> Bool
$c/= :: PublishDiagnosticsParams -> PublishDiagnosticsParams -> Bool
/= :: PublishDiagnosticsParams -> PublishDiagnosticsParams -> Bool
Eq, Eq PublishDiagnosticsParams
Eq PublishDiagnosticsParams =>
(PublishDiagnosticsParams -> PublishDiagnosticsParams -> Ordering)
-> (PublishDiagnosticsParams -> PublishDiagnosticsParams -> Bool)
-> (PublishDiagnosticsParams -> PublishDiagnosticsParams -> Bool)
-> (PublishDiagnosticsParams -> PublishDiagnosticsParams -> Bool)
-> (PublishDiagnosticsParams -> PublishDiagnosticsParams -> Bool)
-> (PublishDiagnosticsParams
    -> PublishDiagnosticsParams -> PublishDiagnosticsParams)
-> (PublishDiagnosticsParams
    -> PublishDiagnosticsParams -> PublishDiagnosticsParams)
-> Ord PublishDiagnosticsParams
PublishDiagnosticsParams -> PublishDiagnosticsParams -> Bool
PublishDiagnosticsParams -> PublishDiagnosticsParams -> Ordering
PublishDiagnosticsParams
-> PublishDiagnosticsParams -> PublishDiagnosticsParams
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 :: PublishDiagnosticsParams -> PublishDiagnosticsParams -> Ordering
compare :: PublishDiagnosticsParams -> PublishDiagnosticsParams -> Ordering
$c< :: PublishDiagnosticsParams -> PublishDiagnosticsParams -> Bool
< :: PublishDiagnosticsParams -> PublishDiagnosticsParams -> Bool
$c<= :: PublishDiagnosticsParams -> PublishDiagnosticsParams -> Bool
<= :: PublishDiagnosticsParams -> PublishDiagnosticsParams -> Bool
$c> :: PublishDiagnosticsParams -> PublishDiagnosticsParams -> Bool
> :: PublishDiagnosticsParams -> PublishDiagnosticsParams -> Bool
$c>= :: PublishDiagnosticsParams -> PublishDiagnosticsParams -> Bool
>= :: PublishDiagnosticsParams -> PublishDiagnosticsParams -> Bool
$cmax :: PublishDiagnosticsParams
-> PublishDiagnosticsParams -> PublishDiagnosticsParams
max :: PublishDiagnosticsParams
-> PublishDiagnosticsParams -> PublishDiagnosticsParams
$cmin :: PublishDiagnosticsParams
-> PublishDiagnosticsParams -> PublishDiagnosticsParams
min :: PublishDiagnosticsParams
-> PublishDiagnosticsParams -> PublishDiagnosticsParams
Ord, (forall x.
 PublishDiagnosticsParams -> Rep PublishDiagnosticsParams x)
-> (forall x.
    Rep PublishDiagnosticsParams x -> PublishDiagnosticsParams)
-> Generic PublishDiagnosticsParams
forall x.
Rep PublishDiagnosticsParams x -> PublishDiagnosticsParams
forall x.
PublishDiagnosticsParams -> Rep PublishDiagnosticsParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x.
PublishDiagnosticsParams -> Rep PublishDiagnosticsParams x
from :: forall x.
PublishDiagnosticsParams -> Rep PublishDiagnosticsParams x
$cto :: forall x.
Rep PublishDiagnosticsParams x -> PublishDiagnosticsParams
to :: forall x.
Rep PublishDiagnosticsParams x -> PublishDiagnosticsParams
Generic)
  deriving anyclass (PublishDiagnosticsParams -> ()
(PublishDiagnosticsParams -> ()) -> NFData PublishDiagnosticsParams
forall a. (a -> ()) -> NFData a
$crnf :: PublishDiagnosticsParams -> ()
rnf :: PublishDiagnosticsParams -> ()
NFData, Eq PublishDiagnosticsParams
Eq PublishDiagnosticsParams =>
(Int -> PublishDiagnosticsParams -> Int)
-> (PublishDiagnosticsParams -> Int)
-> Hashable PublishDiagnosticsParams
Int -> PublishDiagnosticsParams -> Int
PublishDiagnosticsParams -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> PublishDiagnosticsParams -> Int
hashWithSalt :: Int -> PublishDiagnosticsParams -> Int
$chash :: PublishDiagnosticsParams -> Int
hash :: PublishDiagnosticsParams -> Int
Hashable)
  deriving (forall ann. PublishDiagnosticsParams -> Doc ann)
-> (forall ann. [PublishDiagnosticsParams] -> Doc ann)
-> Pretty PublishDiagnosticsParams
forall ann. [PublishDiagnosticsParams] -> Doc ann
forall ann. PublishDiagnosticsParams -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
$cpretty :: forall ann. PublishDiagnosticsParams -> Doc ann
pretty :: forall ann. PublishDiagnosticsParams -> Doc ann
$cprettyList :: forall ann. [PublishDiagnosticsParams] -> Doc ann
prettyList :: forall ann. [PublishDiagnosticsParams] -> Doc ann
Pretty via (ViaJSON PublishDiagnosticsParams)

instance Aeson.ToJSON PublishDiagnosticsParams where
  toJSON :: PublishDiagnosticsParams -> Value
toJSON (PublishDiagnosticsParams Uri
arg0 Maybe Int32
arg1 [Diagnostic]
arg2) = [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
"uri" 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]
    ,String
"version" String -> Maybe Int32 -> [Pair]
forall e kv v.
(KeyValue e kv, ToJSON v) =>
String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Int32
arg1
    ,[Key
"diagnostics" Key -> [Diagnostic] -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= [Diagnostic]
arg2]]

instance Aeson.FromJSON PublishDiagnosticsParams where
  parseJSON :: Value -> Parser PublishDiagnosticsParams
parseJSON = String
-> (Object -> Parser PublishDiagnosticsParams)
-> Value
-> Parser PublishDiagnosticsParams
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"PublishDiagnosticsParams" ((Object -> Parser PublishDiagnosticsParams)
 -> Value -> Parser PublishDiagnosticsParams)
-> (Object -> Parser PublishDiagnosticsParams)
-> Value
-> Parser PublishDiagnosticsParams
forall a b. (a -> b) -> a -> b
$ \Object
arg -> Uri -> Maybe Int32 -> [Diagnostic] -> PublishDiagnosticsParams
PublishDiagnosticsParams (Uri -> Maybe Int32 -> [Diagnostic] -> PublishDiagnosticsParams)
-> Parser Uri
-> Parser (Maybe Int32 -> [Diagnostic] -> PublishDiagnosticsParams)
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
"uri" Parser (Maybe Int32 -> [Diagnostic] -> PublishDiagnosticsParams)
-> Parser (Maybe Int32)
-> Parser ([Diagnostic] -> PublishDiagnosticsParams)
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 (Maybe Int32)
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"version" Parser ([Diagnostic] -> PublishDiagnosticsParams)
-> Parser [Diagnostic] -> Parser PublishDiagnosticsParams
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 [Diagnostic]
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"diagnostics"