{- 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.Unregistration 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.Types.Common

{-|
General parameters to unregister a request or notification.
-}
data Unregistration = Unregistration 
  { {-|
  The id used to unregister the request or notification. Usually an id
  provided during the register request.
  -}
  Unregistration -> Text
_id :: Data.Text.Text
  , {-|
  The method to unregister for.
  -}
  Unregistration -> Text
_method :: Data.Text.Text
  }
  deriving stock (Int -> Unregistration -> ShowS
[Unregistration] -> ShowS
Unregistration -> String
(Int -> Unregistration -> ShowS)
-> (Unregistration -> String)
-> ([Unregistration] -> ShowS)
-> Show Unregistration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Unregistration -> ShowS
showsPrec :: Int -> Unregistration -> ShowS
$cshow :: Unregistration -> String
show :: Unregistration -> String
$cshowList :: [Unregistration] -> ShowS
showList :: [Unregistration] -> ShowS
Show, Unregistration -> Unregistration -> Bool
(Unregistration -> Unregistration -> Bool)
-> (Unregistration -> Unregistration -> Bool) -> Eq Unregistration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Unregistration -> Unregistration -> Bool
== :: Unregistration -> Unregistration -> Bool
$c/= :: Unregistration -> Unregistration -> Bool
/= :: Unregistration -> Unregistration -> Bool
Eq, Eq Unregistration
Eq Unregistration =>
(Unregistration -> Unregistration -> Ordering)
-> (Unregistration -> Unregistration -> Bool)
-> (Unregistration -> Unregistration -> Bool)
-> (Unregistration -> Unregistration -> Bool)
-> (Unregistration -> Unregistration -> Bool)
-> (Unregistration -> Unregistration -> Unregistration)
-> (Unregistration -> Unregistration -> Unregistration)
-> Ord Unregistration
Unregistration -> Unregistration -> Bool
Unregistration -> Unregistration -> Ordering
Unregistration -> Unregistration -> Unregistration
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 :: Unregistration -> Unregistration -> Ordering
compare :: Unregistration -> Unregistration -> Ordering
$c< :: Unregistration -> Unregistration -> Bool
< :: Unregistration -> Unregistration -> Bool
$c<= :: Unregistration -> Unregistration -> Bool
<= :: Unregistration -> Unregistration -> Bool
$c> :: Unregistration -> Unregistration -> Bool
> :: Unregistration -> Unregistration -> Bool
$c>= :: Unregistration -> Unregistration -> Bool
>= :: Unregistration -> Unregistration -> Bool
$cmax :: Unregistration -> Unregistration -> Unregistration
max :: Unregistration -> Unregistration -> Unregistration
$cmin :: Unregistration -> Unregistration -> Unregistration
min :: Unregistration -> Unregistration -> Unregistration
Ord, (forall x. Unregistration -> Rep Unregistration x)
-> (forall x. Rep Unregistration x -> Unregistration)
-> Generic Unregistration
forall x. Rep Unregistration x -> Unregistration
forall x. Unregistration -> Rep Unregistration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Unregistration -> Rep Unregistration x
from :: forall x. Unregistration -> Rep Unregistration x
$cto :: forall x. Rep Unregistration x -> Unregistration
to :: forall x. Rep Unregistration x -> Unregistration
Generic)
  deriving anyclass (Unregistration -> ()
(Unregistration -> ()) -> NFData Unregistration
forall a. (a -> ()) -> NFData a
$crnf :: Unregistration -> ()
rnf :: Unregistration -> ()
NFData, Eq Unregistration
Eq Unregistration =>
(Int -> Unregistration -> Int)
-> (Unregistration -> Int) -> Hashable Unregistration
Int -> Unregistration -> Int
Unregistration -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> Unregistration -> Int
hashWithSalt :: Int -> Unregistration -> Int
$chash :: Unregistration -> Int
hash :: Unregistration -> Int
Hashable)
  deriving (forall ann. Unregistration -> Doc ann)
-> (forall ann. [Unregistration] -> Doc ann)
-> Pretty Unregistration
forall ann. [Unregistration] -> Doc ann
forall ann. Unregistration -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
$cpretty :: forall ann. Unregistration -> Doc ann
pretty :: forall ann. Unregistration -> Doc ann
$cprettyList :: forall ann. [Unregistration] -> Doc ann
prettyList :: forall ann. [Unregistration] -> Doc ann
Pretty via (ViaJSON Unregistration)

instance Aeson.ToJSON Unregistration where
  toJSON :: Unregistration -> Value
toJSON (Unregistration Text
arg0 Text
arg1) = [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
"id" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= Text
arg0]
    ,[Key
"method" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Aeson..= Text
arg1]]

instance Aeson.FromJSON Unregistration where
  parseJSON :: Value -> Parser Unregistration
parseJSON = String
-> (Object -> Parser Unregistration)
-> Value
-> Parser Unregistration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"Unregistration" ((Object -> Parser Unregistration)
 -> Value -> Parser Unregistration)
-> (Object -> Parser Unregistration)
-> Value
-> Parser Unregistration
forall a b. (a -> b) -> a -> b
$ \Object
arg -> Text -> Text -> Unregistration
Unregistration (Text -> Text -> Unregistration)
-> Parser Text -> Parser (Text -> Unregistration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"id" Parser (Text -> Unregistration)
-> Parser Text -> Parser Unregistration
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 Text
forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"method"