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

{-|
A document link is a range in a text document that links to an internal or external resource, like another
text document or a web site.
-}
data DocumentLink = DocumentLink 
  { {-|
  The range this link applies to.
  -}
  DocumentLink -> Range
_range :: Language.LSP.Protocol.Internal.Types.Range.Range
  , {-|
  The uri this link points to. If missing a resolve request is sent later.
  -}
  DocumentLink -> Maybe Text
_target :: (Maybe Data.Text.Text)
  , {-|
  The tooltip text when you hover over this link.

  If a tooltip is provided, is will be displayed in a string that includes instructions on how to
  trigger the link, such as `{0} (ctrl + click)`. The specific instructions vary depending on OS,
  user settings, and localization.

  @since 3.15.0
  -}
  DocumentLink -> Maybe Text
_tooltip :: (Maybe Data.Text.Text)
  , {-|
  A data entry field that is preserved on a document link between a
  DocumentLinkRequest and a DocumentLinkResolveRequest.
  -}
  DocumentLink -> Maybe Value
_data_ :: (Maybe Data.Aeson.Value)
  }
  deriving stock (Int -> DocumentLink -> ShowS
[DocumentLink] -> ShowS
DocumentLink -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DocumentLink] -> ShowS
$cshowList :: [DocumentLink] -> ShowS
show :: DocumentLink -> String
$cshow :: DocumentLink -> String
showsPrec :: Int -> DocumentLink -> ShowS
$cshowsPrec :: Int -> DocumentLink -> ShowS
Show, DocumentLink -> DocumentLink -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DocumentLink -> DocumentLink -> Bool
$c/= :: DocumentLink -> DocumentLink -> Bool
== :: DocumentLink -> DocumentLink -> Bool
$c== :: DocumentLink -> DocumentLink -> Bool
Eq, Eq DocumentLink
DocumentLink -> DocumentLink -> Bool
DocumentLink -> DocumentLink -> Ordering
DocumentLink -> DocumentLink -> DocumentLink
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 :: DocumentLink -> DocumentLink -> DocumentLink
$cmin :: DocumentLink -> DocumentLink -> DocumentLink
max :: DocumentLink -> DocumentLink -> DocumentLink
$cmax :: DocumentLink -> DocumentLink -> DocumentLink
>= :: DocumentLink -> DocumentLink -> Bool
$c>= :: DocumentLink -> DocumentLink -> Bool
> :: DocumentLink -> DocumentLink -> Bool
$c> :: DocumentLink -> DocumentLink -> Bool
<= :: DocumentLink -> DocumentLink -> Bool
$c<= :: DocumentLink -> DocumentLink -> Bool
< :: DocumentLink -> DocumentLink -> Bool
$c< :: DocumentLink -> DocumentLink -> Bool
compare :: DocumentLink -> DocumentLink -> Ordering
$ccompare :: DocumentLink -> DocumentLink -> Ordering
Ord, forall x. Rep DocumentLink x -> DocumentLink
forall x. DocumentLink -> Rep DocumentLink x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DocumentLink x -> DocumentLink
$cfrom :: forall x. DocumentLink -> Rep DocumentLink x
Generic)
  deriving anyclass (DocumentLink -> ()
forall a. (a -> ()) -> NFData a
rnf :: DocumentLink -> ()
$crnf :: DocumentLink -> ()
NFData, Eq DocumentLink
Int -> DocumentLink -> Int
DocumentLink -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: DocumentLink -> Int
$chash :: DocumentLink -> Int
hashWithSalt :: Int -> DocumentLink -> Int
$chashWithSalt :: Int -> DocumentLink -> Int
Hashable)
  deriving forall ann. [DocumentLink] -> Doc ann
forall ann. DocumentLink -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [DocumentLink] -> Doc ann
$cprettyList :: forall ann. [DocumentLink] -> Doc ann
pretty :: forall ann. DocumentLink -> Doc ann
$cpretty :: forall ann. DocumentLink -> Doc ann
Pretty via (ViaJSON DocumentLink)

instance Aeson.ToJSON DocumentLink where
  toJSON :: DocumentLink -> Value
toJSON (DocumentLink Range
arg0 Maybe Text
arg1 Maybe Text
arg2 Maybe Value
arg3) = [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
"target" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Text
arg1
    ,String
"tooltip" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Text
arg2
    ,String
"data" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Value
arg3]

instance Aeson.FromJSON DocumentLink where
  parseJSON :: Value -> Parser DocumentLink
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"DocumentLink" forall a b. (a -> b) -> a -> b
$ \Object
arg -> Range -> Maybe Text -> Maybe Text -> Maybe Value -> DocumentLink
DocumentLink 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
"target" 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
"tooltip" 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"