{- 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.Moniker 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 Data.Text
import qualified Language.LSP.Protocol.Internal.Types.MonikerKind
import qualified Language.LSP.Protocol.Internal.Types.UniquenessLevel
import qualified Language.LSP.Protocol.Types.Common

{-|
Moniker definition to match LSIF 0.5 moniker definition.

@since 3.16.0
-}
data Moniker = Moniker 
  { {-|
  The scheme of the moniker. For example tsc or .Net
  -}
  Moniker -> Text
_scheme :: Data.Text.Text
  , {-|
  The identifier of the moniker. The value is opaque in LSIF however
  schema owners are allowed to define the structure if they want.
  -}
  Moniker -> Text
_identifier :: Data.Text.Text
  , {-|
  The scope in which the moniker is unique
  -}
  Moniker -> UniquenessLevel
_unique :: Language.LSP.Protocol.Internal.Types.UniquenessLevel.UniquenessLevel
  , {-|
  The moniker kind if known.
  -}
  Moniker -> Maybe MonikerKind
_kind :: (Maybe Language.LSP.Protocol.Internal.Types.MonikerKind.MonikerKind)
  }
  deriving stock (Int -> Moniker -> ShowS
[Moniker] -> ShowS
Moniker -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Moniker] -> ShowS
$cshowList :: [Moniker] -> ShowS
show :: Moniker -> String
$cshow :: Moniker -> String
showsPrec :: Int -> Moniker -> ShowS
$cshowsPrec :: Int -> Moniker -> ShowS
Show, Moniker -> Moniker -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Moniker -> Moniker -> Bool
$c/= :: Moniker -> Moniker -> Bool
== :: Moniker -> Moniker -> Bool
$c== :: Moniker -> Moniker -> Bool
Eq, Eq Moniker
Moniker -> Moniker -> Bool
Moniker -> Moniker -> Ordering
Moniker -> Moniker -> Moniker
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 :: Moniker -> Moniker -> Moniker
$cmin :: Moniker -> Moniker -> Moniker
max :: Moniker -> Moniker -> Moniker
$cmax :: Moniker -> Moniker -> Moniker
>= :: Moniker -> Moniker -> Bool
$c>= :: Moniker -> Moniker -> Bool
> :: Moniker -> Moniker -> Bool
$c> :: Moniker -> Moniker -> Bool
<= :: Moniker -> Moniker -> Bool
$c<= :: Moniker -> Moniker -> Bool
< :: Moniker -> Moniker -> Bool
$c< :: Moniker -> Moniker -> Bool
compare :: Moniker -> Moniker -> Ordering
$ccompare :: Moniker -> Moniker -> Ordering
Ord, forall x. Rep Moniker x -> Moniker
forall x. Moniker -> Rep Moniker x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Moniker x -> Moniker
$cfrom :: forall x. Moniker -> Rep Moniker x
Generic)
  deriving anyclass (Moniker -> ()
forall a. (a -> ()) -> NFData a
rnf :: Moniker -> ()
$crnf :: Moniker -> ()
NFData, Eq Moniker
Int -> Moniker -> Int
Moniker -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: Moniker -> Int
$chash :: Moniker -> Int
hashWithSalt :: Int -> Moniker -> Int
$chashWithSalt :: Int -> Moniker -> Int
Hashable)
  deriving forall ann. [Moniker] -> Doc ann
forall ann. Moniker -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [Moniker] -> Doc ann
$cprettyList :: forall ann. [Moniker] -> Doc ann
pretty :: forall ann. Moniker -> Doc ann
$cpretty :: forall ann. Moniker -> Doc ann
Pretty via (ViaJSON Moniker)

instance Aeson.ToJSON Moniker where
  toJSON :: Moniker -> Value
toJSON (Moniker Text
arg0 Text
arg1 UniquenessLevel
arg2 Maybe MonikerKind
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
"scheme" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Text
arg0]
    ,[Key
"identifier" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Text
arg1]
    ,[Key
"unique" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= UniquenessLevel
arg2]
    ,String
"kind" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe MonikerKind
arg3]

instance Aeson.FromJSON Moniker where
  parseJSON :: Value -> Parser Moniker
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"Moniker" forall a b. (a -> b) -> a -> b
$ \Object
arg -> Text -> Text -> UniquenessLevel -> Maybe MonikerKind -> Moniker
Moniker forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"scheme" 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
"identifier" 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
"unique" 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
"kind"