{- 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.InitializeResult 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 as Row
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.ServerCapabilities
import qualified Language.LSP.Protocol.Types.Common

{-|
The result returned from an initialize request.
-}
data InitializeResult = InitializeResult 
  { {-|
  The capabilities the language server provides.
  -}
  InitializeResult -> ServerCapabilities
_capabilities :: Language.LSP.Protocol.Internal.Types.ServerCapabilities.ServerCapabilities
  , {-|
  Information about the server.

  @since 3.15.0
  -}
  InitializeResult
-> Maybe
     (Rec
        (("name" .== Text)
         .+ (Extend "version" (Maybe Text) ('R '[]) .+ 'R '[])))
_serverInfo :: (Maybe (Row.Rec ("name" Row..== Data.Text.Text Row..+ ("version" Row..== (Maybe Data.Text.Text) Row..+ Row.Empty))))
  }
  deriving stock (Int -> InitializeResult -> ShowS
[InitializeResult] -> ShowS
InitializeResult -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InitializeResult] -> ShowS
$cshowList :: [InitializeResult] -> ShowS
show :: InitializeResult -> String
$cshow :: InitializeResult -> String
showsPrec :: Int -> InitializeResult -> ShowS
$cshowsPrec :: Int -> InitializeResult -> ShowS
Show, InitializeResult -> InitializeResult -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InitializeResult -> InitializeResult -> Bool
$c/= :: InitializeResult -> InitializeResult -> Bool
== :: InitializeResult -> InitializeResult -> Bool
$c== :: InitializeResult -> InitializeResult -> Bool
Eq, Eq InitializeResult
InitializeResult -> InitializeResult -> Bool
InitializeResult -> InitializeResult -> Ordering
InitializeResult -> InitializeResult -> InitializeResult
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 :: InitializeResult -> InitializeResult -> InitializeResult
$cmin :: InitializeResult -> InitializeResult -> InitializeResult
max :: InitializeResult -> InitializeResult -> InitializeResult
$cmax :: InitializeResult -> InitializeResult -> InitializeResult
>= :: InitializeResult -> InitializeResult -> Bool
$c>= :: InitializeResult -> InitializeResult -> Bool
> :: InitializeResult -> InitializeResult -> Bool
$c> :: InitializeResult -> InitializeResult -> Bool
<= :: InitializeResult -> InitializeResult -> Bool
$c<= :: InitializeResult -> InitializeResult -> Bool
< :: InitializeResult -> InitializeResult -> Bool
$c< :: InitializeResult -> InitializeResult -> Bool
compare :: InitializeResult -> InitializeResult -> Ordering
$ccompare :: InitializeResult -> InitializeResult -> Ordering
Ord, forall x. Rep InitializeResult x -> InitializeResult
forall x. InitializeResult -> Rep InitializeResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InitializeResult x -> InitializeResult
$cfrom :: forall x. InitializeResult -> Rep InitializeResult x
Generic)
  deriving anyclass (InitializeResult -> ()
forall a. (a -> ()) -> NFData a
rnf :: InitializeResult -> ()
$crnf :: InitializeResult -> ()
NFData, Eq InitializeResult
Int -> InitializeResult -> Int
InitializeResult -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: InitializeResult -> Int
$chash :: InitializeResult -> Int
hashWithSalt :: Int -> InitializeResult -> Int
$chashWithSalt :: Int -> InitializeResult -> Int
Hashable)
  deriving forall ann. [InitializeResult] -> Doc ann
forall ann. InitializeResult -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [InitializeResult] -> Doc ann
$cprettyList :: forall ann. [InitializeResult] -> Doc ann
pretty :: forall ann. InitializeResult -> Doc ann
$cpretty :: forall ann. InitializeResult -> Doc ann
Pretty via (ViaJSON InitializeResult)

instance Aeson.ToJSON InitializeResult where
  toJSON :: InitializeResult -> Value
toJSON (InitializeResult ServerCapabilities
arg0 Maybe
  (Rec
     (("name" .== Text)
      .+ (Extend "version" (Maybe Text) ('R '[]) .+ 'R '[])))
arg1) = [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
"capabilities" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= ServerCapabilities
arg0]
    ,String
"serverInfo" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe
  (Rec
     (("name" .== Text)
      .+ (Extend "version" (Maybe Text) ('R '[]) .+ 'R '[])))
arg1]

instance Aeson.FromJSON InitializeResult where
  parseJSON :: Value -> Parser InitializeResult
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"InitializeResult" forall a b. (a -> b) -> a -> b
$ \Object
arg -> ServerCapabilities
-> Maybe
     (Rec
        (("name" .== Text)
         .+ (Extend "version" (Maybe Text) ('R '[]) .+ 'R '[])))
-> InitializeResult
InitializeResult forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"capabilities" 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
"serverInfo"