{- 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
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Unregistration] -> ShowS
$cshowList :: [Unregistration] -> ShowS
show :: Unregistration -> String
$cshow :: Unregistration -> String
showsPrec :: Int -> Unregistration -> ShowS
$cshowsPrec :: Int -> Unregistration -> ShowS
Show, Unregistration -> Unregistration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Unregistration -> Unregistration -> Bool
$c/= :: Unregistration -> Unregistration -> Bool
== :: Unregistration -> Unregistration -> Bool
$c== :: Unregistration -> Unregistration -> Bool
Eq, Eq 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
min :: Unregistration -> Unregistration -> Unregistration
$cmin :: Unregistration -> Unregistration -> Unregistration
max :: Unregistration -> Unregistration -> Unregistration
$cmax :: Unregistration -> Unregistration -> Unregistration
>= :: Unregistration -> Unregistration -> Bool
$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
compare :: Unregistration -> Unregistration -> Ordering
$ccompare :: Unregistration -> Unregistration -> Ordering
Ord, 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
$cto :: forall x. Rep Unregistration x -> Unregistration
$cfrom :: forall x. Unregistration -> Rep Unregistration x
Generic)
  deriving anyclass (Unregistration -> ()
forall a. (a -> ()) -> NFData a
rnf :: Unregistration -> ()
$crnf :: Unregistration -> ()
NFData, Eq Unregistration
Int -> Unregistration -> Int
Unregistration -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: Unregistration -> Int
$chash :: Unregistration -> Int
hashWithSalt :: Int -> Unregistration -> Int
$chashWithSalt :: Int -> Unregistration -> Int
Hashable)
  deriving forall ann. [Unregistration] -> Doc ann
forall ann. Unregistration -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [Unregistration] -> Doc ann
$cprettyList :: forall ann. [Unregistration] -> Doc ann
pretty :: forall ann. Unregistration -> Doc ann
$cpretty :: 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 forall a b. (a -> b) -> a -> b
$ forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat forall a b. (a -> b) -> a -> b
$  [[Key
"id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Text
arg0]
    ,[Key
"method" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Text
arg1]]

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