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

{-|
A text document identifier to optionally denote a specific version of a text document.
-}
data OptionalVersionedTextDocumentIdentifier = OptionalVersionedTextDocumentIdentifier 
  { {-|
  The text document's uri.
  -}
  OptionalVersionedTextDocumentIdentifier -> Uri
_uri :: Language.LSP.Protocol.Types.Uri.Uri
  , {-|
  The version number of this document. If a versioned text document identifier
  is sent from the server to the client and the file is not open in the editor
  (the server has not received an open notification before) the server can send
  `null` to indicate that the version is unknown and the content on disk is the
  truth (as specified with document content ownership).
  -}
  OptionalVersionedTextDocumentIdentifier -> Int32 |? Null
_version :: (Language.LSP.Protocol.Types.Common.Int32 Language.LSP.Protocol.Types.Common.|? Language.LSP.Protocol.Types.Common.Null)
  }
  deriving stock (Int -> OptionalVersionedTextDocumentIdentifier -> ShowS
[OptionalVersionedTextDocumentIdentifier] -> ShowS
OptionalVersionedTextDocumentIdentifier -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OptionalVersionedTextDocumentIdentifier] -> ShowS
$cshowList :: [OptionalVersionedTextDocumentIdentifier] -> ShowS
show :: OptionalVersionedTextDocumentIdentifier -> String
$cshow :: OptionalVersionedTextDocumentIdentifier -> String
showsPrec :: Int -> OptionalVersionedTextDocumentIdentifier -> ShowS
$cshowsPrec :: Int -> OptionalVersionedTextDocumentIdentifier -> ShowS
Show, OptionalVersionedTextDocumentIdentifier
-> OptionalVersionedTextDocumentIdentifier -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OptionalVersionedTextDocumentIdentifier
-> OptionalVersionedTextDocumentIdentifier -> Bool
$c/= :: OptionalVersionedTextDocumentIdentifier
-> OptionalVersionedTextDocumentIdentifier -> Bool
== :: OptionalVersionedTextDocumentIdentifier
-> OptionalVersionedTextDocumentIdentifier -> Bool
$c== :: OptionalVersionedTextDocumentIdentifier
-> OptionalVersionedTextDocumentIdentifier -> Bool
Eq, Eq OptionalVersionedTextDocumentIdentifier
OptionalVersionedTextDocumentIdentifier
-> OptionalVersionedTextDocumentIdentifier -> Bool
OptionalVersionedTextDocumentIdentifier
-> OptionalVersionedTextDocumentIdentifier -> Ordering
OptionalVersionedTextDocumentIdentifier
-> OptionalVersionedTextDocumentIdentifier
-> OptionalVersionedTextDocumentIdentifier
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 :: OptionalVersionedTextDocumentIdentifier
-> OptionalVersionedTextDocumentIdentifier
-> OptionalVersionedTextDocumentIdentifier
$cmin :: OptionalVersionedTextDocumentIdentifier
-> OptionalVersionedTextDocumentIdentifier
-> OptionalVersionedTextDocumentIdentifier
max :: OptionalVersionedTextDocumentIdentifier
-> OptionalVersionedTextDocumentIdentifier
-> OptionalVersionedTextDocumentIdentifier
$cmax :: OptionalVersionedTextDocumentIdentifier
-> OptionalVersionedTextDocumentIdentifier
-> OptionalVersionedTextDocumentIdentifier
>= :: OptionalVersionedTextDocumentIdentifier
-> OptionalVersionedTextDocumentIdentifier -> Bool
$c>= :: OptionalVersionedTextDocumentIdentifier
-> OptionalVersionedTextDocumentIdentifier -> Bool
> :: OptionalVersionedTextDocumentIdentifier
-> OptionalVersionedTextDocumentIdentifier -> Bool
$c> :: OptionalVersionedTextDocumentIdentifier
-> OptionalVersionedTextDocumentIdentifier -> Bool
<= :: OptionalVersionedTextDocumentIdentifier
-> OptionalVersionedTextDocumentIdentifier -> Bool
$c<= :: OptionalVersionedTextDocumentIdentifier
-> OptionalVersionedTextDocumentIdentifier -> Bool
< :: OptionalVersionedTextDocumentIdentifier
-> OptionalVersionedTextDocumentIdentifier -> Bool
$c< :: OptionalVersionedTextDocumentIdentifier
-> OptionalVersionedTextDocumentIdentifier -> Bool
compare :: OptionalVersionedTextDocumentIdentifier
-> OptionalVersionedTextDocumentIdentifier -> Ordering
$ccompare :: OptionalVersionedTextDocumentIdentifier
-> OptionalVersionedTextDocumentIdentifier -> Ordering
Ord, forall x.
Rep OptionalVersionedTextDocumentIdentifier x
-> OptionalVersionedTextDocumentIdentifier
forall x.
OptionalVersionedTextDocumentIdentifier
-> Rep OptionalVersionedTextDocumentIdentifier x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep OptionalVersionedTextDocumentIdentifier x
-> OptionalVersionedTextDocumentIdentifier
$cfrom :: forall x.
OptionalVersionedTextDocumentIdentifier
-> Rep OptionalVersionedTextDocumentIdentifier x
Generic)
  deriving anyclass (OptionalVersionedTextDocumentIdentifier -> ()
forall a. (a -> ()) -> NFData a
rnf :: OptionalVersionedTextDocumentIdentifier -> ()
$crnf :: OptionalVersionedTextDocumentIdentifier -> ()
NFData, Eq OptionalVersionedTextDocumentIdentifier
Int -> OptionalVersionedTextDocumentIdentifier -> Int
OptionalVersionedTextDocumentIdentifier -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: OptionalVersionedTextDocumentIdentifier -> Int
$chash :: OptionalVersionedTextDocumentIdentifier -> Int
hashWithSalt :: Int -> OptionalVersionedTextDocumentIdentifier -> Int
$chashWithSalt :: Int -> OptionalVersionedTextDocumentIdentifier -> Int
Hashable)
  deriving forall ann. [OptionalVersionedTextDocumentIdentifier] -> Doc ann
forall ann. OptionalVersionedTextDocumentIdentifier -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [OptionalVersionedTextDocumentIdentifier] -> Doc ann
$cprettyList :: forall ann. [OptionalVersionedTextDocumentIdentifier] -> Doc ann
pretty :: forall ann. OptionalVersionedTextDocumentIdentifier -> Doc ann
$cpretty :: forall ann. OptionalVersionedTextDocumentIdentifier -> Doc ann
Pretty via (ViaJSON OptionalVersionedTextDocumentIdentifier)

instance Aeson.ToJSON OptionalVersionedTextDocumentIdentifier where
  toJSON :: OptionalVersionedTextDocumentIdentifier -> Value
toJSON (OptionalVersionedTextDocumentIdentifier Uri
arg0 Int32 |? Null
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
"uri" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Uri
arg0]
    ,[Key
"version" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Int32 |? Null
arg1]]

instance Aeson.FromJSON OptionalVersionedTextDocumentIdentifier where
  parseJSON :: Value -> Parser OptionalVersionedTextDocumentIdentifier
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"OptionalVersionedTextDocumentIdentifier" forall a b. (a -> b) -> a -> b
$ \Object
arg -> Uri -> (Int32 |? Null) -> OptionalVersionedTextDocumentIdentifier
OptionalVersionedTextDocumentIdentifier 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 a
Aeson..: Key
"version"