{- 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
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PublishDiagnosticsParams] -> ShowS
$cshowList :: [PublishDiagnosticsParams] -> ShowS
show :: PublishDiagnosticsParams -> String
$cshow :: PublishDiagnosticsParams -> String
showsPrec :: Int -> PublishDiagnosticsParams -> ShowS
$cshowsPrec :: Int -> PublishDiagnosticsParams -> ShowS
Show, PublishDiagnosticsParams -> PublishDiagnosticsParams -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PublishDiagnosticsParams -> PublishDiagnosticsParams -> Bool
$c/= :: PublishDiagnosticsParams -> PublishDiagnosticsParams -> Bool
== :: PublishDiagnosticsParams -> PublishDiagnosticsParams -> Bool
$c== :: PublishDiagnosticsParams -> PublishDiagnosticsParams -> Bool
Eq, Eq 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
min :: PublishDiagnosticsParams
-> PublishDiagnosticsParams -> PublishDiagnosticsParams
$cmin :: PublishDiagnosticsParams
-> PublishDiagnosticsParams -> PublishDiagnosticsParams
max :: PublishDiagnosticsParams
-> PublishDiagnosticsParams -> PublishDiagnosticsParams
$cmax :: PublishDiagnosticsParams
-> PublishDiagnosticsParams -> PublishDiagnosticsParams
>= :: PublishDiagnosticsParams -> PublishDiagnosticsParams -> Bool
$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
compare :: PublishDiagnosticsParams -> PublishDiagnosticsParams -> Ordering
$ccompare :: PublishDiagnosticsParams -> PublishDiagnosticsParams -> Ordering
Ord, 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
$cto :: forall x.
Rep PublishDiagnosticsParams x -> PublishDiagnosticsParams
$cfrom :: forall x.
PublishDiagnosticsParams -> Rep PublishDiagnosticsParams x
Generic)
  deriving anyclass (PublishDiagnosticsParams -> ()
forall a. (a -> ()) -> NFData a
rnf :: PublishDiagnosticsParams -> ()
$crnf :: PublishDiagnosticsParams -> ()
NFData, Eq PublishDiagnosticsParams
Int -> PublishDiagnosticsParams -> Int
PublishDiagnosticsParams -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: PublishDiagnosticsParams -> Int
$chash :: PublishDiagnosticsParams -> Int
hashWithSalt :: Int -> PublishDiagnosticsParams -> Int
$chashWithSalt :: Int -> PublishDiagnosticsParams -> Int
Hashable)
  deriving forall ann. [PublishDiagnosticsParams] -> Doc ann
forall ann. PublishDiagnosticsParams -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [PublishDiagnosticsParams] -> Doc ann
$cprettyList :: forall ann. [PublishDiagnosticsParams] -> Doc ann
pretty :: forall ann. PublishDiagnosticsParams -> Doc ann
$cpretty :: 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 forall a b. (a -> b) -> a -> b
$ forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat forall a b. (a -> b) -> a -> b
$  [[Key
"uri" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Uri
arg0]
    ,String
"version" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Int32
arg1
    ,[Key
"diagnostics" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= [Diagnostic]
arg2]]

instance Aeson.FromJSON PublishDiagnosticsParams where
  parseJSON :: Value -> Parser PublishDiagnosticsParams
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"PublishDiagnosticsParams" forall a b. (a -> b) -> a -> b
$ \Object
arg -> Uri -> Maybe Int32 -> [Diagnostic] -> PublishDiagnosticsParams
PublishDiagnosticsParams forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"uri" 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
"version" 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
"diagnostics"