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

{-|
Params to show a document.

@since 3.16.0
-}
data ShowDocumentParams = ShowDocumentParams 
  { {-|
  The document uri to show.
  -}
  ShowDocumentParams -> Uri
_uri :: Language.LSP.Protocol.Types.Uri.Uri
  , {-|
  Indicates to show the resource in an external program.
  To show for example `https://code.visualstudio.com/`
  in the default WEB browser set `external` to `true`.
  -}
  ShowDocumentParams -> Maybe Bool
_external :: (Maybe Bool)
  , {-|
  An optional property to indicate whether the editor
  showing the document should take focus or not.
  Clients might ignore this property if an external
  program is started.
  -}
  ShowDocumentParams -> Maybe Bool
_takeFocus :: (Maybe Bool)
  , {-|
  An optional selection range if the document is a text
  document. Clients might ignore the property if an
  external program is started or the file is not a text
  file.
  -}
  ShowDocumentParams -> Maybe Range
_selection :: (Maybe Language.LSP.Protocol.Internal.Types.Range.Range)
  }
  deriving stock (Int -> ShowDocumentParams -> ShowS
[ShowDocumentParams] -> ShowS
ShowDocumentParams -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ShowDocumentParams] -> ShowS
$cshowList :: [ShowDocumentParams] -> ShowS
show :: ShowDocumentParams -> String
$cshow :: ShowDocumentParams -> String
showsPrec :: Int -> ShowDocumentParams -> ShowS
$cshowsPrec :: Int -> ShowDocumentParams -> ShowS
Show, ShowDocumentParams -> ShowDocumentParams -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ShowDocumentParams -> ShowDocumentParams -> Bool
$c/= :: ShowDocumentParams -> ShowDocumentParams -> Bool
== :: ShowDocumentParams -> ShowDocumentParams -> Bool
$c== :: ShowDocumentParams -> ShowDocumentParams -> Bool
Eq, Eq ShowDocumentParams
ShowDocumentParams -> ShowDocumentParams -> Bool
ShowDocumentParams -> ShowDocumentParams -> Ordering
ShowDocumentParams -> ShowDocumentParams -> ShowDocumentParams
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 :: ShowDocumentParams -> ShowDocumentParams -> ShowDocumentParams
$cmin :: ShowDocumentParams -> ShowDocumentParams -> ShowDocumentParams
max :: ShowDocumentParams -> ShowDocumentParams -> ShowDocumentParams
$cmax :: ShowDocumentParams -> ShowDocumentParams -> ShowDocumentParams
>= :: ShowDocumentParams -> ShowDocumentParams -> Bool
$c>= :: ShowDocumentParams -> ShowDocumentParams -> Bool
> :: ShowDocumentParams -> ShowDocumentParams -> Bool
$c> :: ShowDocumentParams -> ShowDocumentParams -> Bool
<= :: ShowDocumentParams -> ShowDocumentParams -> Bool
$c<= :: ShowDocumentParams -> ShowDocumentParams -> Bool
< :: ShowDocumentParams -> ShowDocumentParams -> Bool
$c< :: ShowDocumentParams -> ShowDocumentParams -> Bool
compare :: ShowDocumentParams -> ShowDocumentParams -> Ordering
$ccompare :: ShowDocumentParams -> ShowDocumentParams -> Ordering
Ord, forall x. Rep ShowDocumentParams x -> ShowDocumentParams
forall x. ShowDocumentParams -> Rep ShowDocumentParams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ShowDocumentParams x -> ShowDocumentParams
$cfrom :: forall x. ShowDocumentParams -> Rep ShowDocumentParams x
Generic)
  deriving anyclass (ShowDocumentParams -> ()
forall a. (a -> ()) -> NFData a
rnf :: ShowDocumentParams -> ()
$crnf :: ShowDocumentParams -> ()
NFData, Eq ShowDocumentParams
Int -> ShowDocumentParams -> Int
ShowDocumentParams -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: ShowDocumentParams -> Int
$chash :: ShowDocumentParams -> Int
hashWithSalt :: Int -> ShowDocumentParams -> Int
$chashWithSalt :: Int -> ShowDocumentParams -> Int
Hashable)
  deriving forall ann. [ShowDocumentParams] -> Doc ann
forall ann. ShowDocumentParams -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [ShowDocumentParams] -> Doc ann
$cprettyList :: forall ann. [ShowDocumentParams] -> Doc ann
pretty :: forall ann. ShowDocumentParams -> Doc ann
$cpretty :: forall ann. ShowDocumentParams -> Doc ann
Pretty via (ViaJSON ShowDocumentParams)

instance Aeson.ToJSON ShowDocumentParams where
  toJSON :: ShowDocumentParams -> Value
toJSON (ShowDocumentParams Uri
arg0 Maybe Bool
arg1 Maybe Bool
arg2 Maybe Range
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
"uri" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Uri
arg0]
    ,String
"external" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Bool
arg1
    ,String
"takeFocus" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Bool
arg2
    ,String
"selection" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Range
arg3]

instance Aeson.FromJSON ShowDocumentParams where
  parseJSON :: Value -> Parser ShowDocumentParams
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"ShowDocumentParams" forall a b. (a -> b) -> a -> b
$ \Object
arg -> Uri
-> Maybe Bool -> Maybe Bool -> Maybe Range -> ShowDocumentParams
ShowDocumentParams 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
"external" 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
"takeFocus" 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
"selection"