{- 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
(Int -> ShowDocumentParams -> ShowS)
-> (ShowDocumentParams -> String)
-> ([ShowDocumentParams] -> ShowS)
-> Show ShowDocumentParams
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ShowDocumentParams -> ShowS
showsPrec :: Int -> ShowDocumentParams -> ShowS
$cshow :: ShowDocumentParams -> String
show :: ShowDocumentParams -> String
$cshowList :: [ShowDocumentParams] -> ShowS
showList :: [ShowDocumentParams] -> ShowS
Show, ShowDocumentParams -> ShowDocumentParams -> Bool
(ShowDocumentParams -> ShowDocumentParams -> Bool)
-> (ShowDocumentParams -> ShowDocumentParams -> Bool)
-> Eq ShowDocumentParams
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ShowDocumentParams -> ShowDocumentParams -> Bool
== :: ShowDocumentParams -> ShowDocumentParams -> Bool
$c/= :: ShowDocumentParams -> ShowDocumentParams -> Bool
/= :: ShowDocumentParams -> ShowDocumentParams -> Bool
Eq, Eq ShowDocumentParams
Eq ShowDocumentParams =>
(ShowDocumentParams -> ShowDocumentParams -> Ordering)
-> (ShowDocumentParams -> ShowDocumentParams -> Bool)
-> (ShowDocumentParams -> ShowDocumentParams -> Bool)
-> (ShowDocumentParams -> ShowDocumentParams -> Bool)
-> (ShowDocumentParams -> ShowDocumentParams -> Bool)
-> (ShowDocumentParams -> ShowDocumentParams -> ShowDocumentParams)
-> (ShowDocumentParams -> ShowDocumentParams -> ShowDocumentParams)
-> Ord 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
$ccompare :: ShowDocumentParams -> ShowDocumentParams -> Ordering
compare :: ShowDocumentParams -> ShowDocumentParams -> Ordering
$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
>= :: ShowDocumentParams -> ShowDocumentParams -> Bool
$cmax :: ShowDocumentParams -> ShowDocumentParams -> ShowDocumentParams
max :: ShowDocumentParams -> ShowDocumentParams -> ShowDocumentParams
$cmin :: ShowDocumentParams -> ShowDocumentParams -> ShowDocumentParams
min :: ShowDocumentParams -> ShowDocumentParams -> ShowDocumentParams
Ord, (forall x. ShowDocumentParams -> Rep ShowDocumentParams x)
-> (forall x. Rep ShowDocumentParams x -> ShowDocumentParams)
-> Generic ShowDocumentParams
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
$cfrom :: forall x. ShowDocumentParams -> Rep ShowDocumentParams x
from :: forall x. ShowDocumentParams -> Rep ShowDocumentParams x
$cto :: forall x. Rep ShowDocumentParams x -> ShowDocumentParams
to :: forall x. Rep ShowDocumentParams x -> ShowDocumentParams
Generic)
  deriving anyclass (ShowDocumentParams -> ()
(ShowDocumentParams -> ()) -> NFData ShowDocumentParams
forall a. (a -> ()) -> NFData a
$crnf :: ShowDocumentParams -> ()
rnf :: ShowDocumentParams -> ()
NFData, Eq ShowDocumentParams
Eq ShowDocumentParams =>
(Int -> ShowDocumentParams -> Int)
-> (ShowDocumentParams -> Int) -> Hashable ShowDocumentParams
Int -> ShowDocumentParams -> Int
ShowDocumentParams -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> ShowDocumentParams -> Int
hashWithSalt :: Int -> ShowDocumentParams -> Int
$chash :: ShowDocumentParams -> Int
hash :: ShowDocumentParams -> Int
Hashable)
  deriving (forall ann. ShowDocumentParams -> Doc ann)
-> (forall ann. [ShowDocumentParams] -> Doc ann)
-> Pretty ShowDocumentParams
forall ann. [ShowDocumentParams] -> Doc ann
forall ann. ShowDocumentParams -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
$cpretty :: forall ann. ShowDocumentParams -> Doc ann
pretty :: forall ann. ShowDocumentParams -> Doc ann
$cprettyList :: forall ann. [ShowDocumentParams] -> Doc ann
prettyList :: 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 ([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
"external" String -> Maybe Bool -> [Pair]
forall e kv v.
(KeyValue e kv, ToJSON v) =>
String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Bool
arg1
    ,String
"takeFocus" String -> Maybe Bool -> [Pair]
forall e kv v.
(KeyValue e kv, ToJSON v) =>
String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Bool
arg2
    ,String
"selection" String -> Maybe Range -> [Pair]
forall e kv v.
(KeyValue e 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 = String
-> (Object -> Parser ShowDocumentParams)
-> Value
-> Parser ShowDocumentParams
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"ShowDocumentParams" ((Object -> Parser ShowDocumentParams)
 -> Value -> Parser ShowDocumentParams)
-> (Object -> Parser ShowDocumentParams)
-> Value
-> Parser ShowDocumentParams
forall a b. (a -> b) -> a -> b
$ \Object
arg -> Uri
-> Maybe Bool -> Maybe Bool -> Maybe Range -> ShowDocumentParams
ShowDocumentParams (Uri
 -> Maybe Bool -> Maybe Bool -> Maybe Range -> ShowDocumentParams)
-> Parser Uri
-> Parser
     (Maybe Bool -> Maybe Bool -> Maybe Range -> ShowDocumentParams)
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 Bool -> Maybe Bool -> Maybe Range -> ShowDocumentParams)
-> Parser (Maybe Bool)
-> Parser (Maybe Bool -> Maybe Range -> ShowDocumentParams)
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 Bool)
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"external" Parser (Maybe Bool -> Maybe Range -> ShowDocumentParams)
-> Parser (Maybe Bool)
-> Parser (Maybe Range -> ShowDocumentParams)
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 Bool)
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"takeFocus" Parser (Maybe Range -> ShowDocumentParams)
-> Parser (Maybe Range) -> Parser ShowDocumentParams
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 Range)
forall v. FromJSON v => Object -> Key -> Parser (Maybe v)
Language.LSP.Protocol.Types.Common..:!? Key
"selection"