

-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.Wp.Callbacks
    ( 

 -- * Signals


-- ** DynamicRulesConditionCallback #signal:DynamicRulesConditionCallback#

    C_DynamicRulesConditionCallback         ,
    DynamicRulesConditionCallback           ,
    DynamicRulesConditionCallback_WithClosures,
    drop_closures_DynamicRulesConditionCallback,
    dynamic_DynamicRulesConditionCallback   ,
    genClosure_DynamicRulesConditionCallback,
    mk_DynamicRulesConditionCallback        ,
    noDynamicRulesConditionCallback         ,
    noDynamicRulesConditionCallback_WithClosures,
    wrap_DynamicRulesConditionCallback      ,


-- ** IteratorFoldFunc #signal:IteratorFoldFunc#

    C_IteratorFoldFunc                      ,
    IteratorFoldFunc                        ,
    dynamic_IteratorFoldFunc                ,
    genClosure_IteratorFoldFunc             ,
    mk_IteratorFoldFunc                     ,
    noIteratorFoldFunc                      ,
    wrap_IteratorFoldFunc                   ,


-- ** IteratorForeachFunc #signal:IteratorForeachFunc#

    C_IteratorForeachFunc                   ,
    IteratorForeachFunc                     ,
    dynamic_IteratorForeachFunc             ,
    genClosure_IteratorForeachFunc          ,
    mk_IteratorForeachFunc                  ,
    noIteratorForeachFunc                   ,
    wrap_IteratorForeachFunc                ,


-- ** IteratorMethodsFinalizeFieldCallback #signal:IteratorMethodsFinalizeFieldCallback#

    C_IteratorMethodsFinalizeFieldCallback  ,
    IteratorMethodsFinalizeFieldCallback    ,
    dynamic_IteratorMethodsFinalizeFieldCallback,
    genClosure_IteratorMethodsFinalizeFieldCallback,
    mk_IteratorMethodsFinalizeFieldCallback ,
    noIteratorMethodsFinalizeFieldCallback  ,
    wrap_IteratorMethodsFinalizeFieldCallback,


-- ** IteratorMethodsNextFieldCallback #signal:IteratorMethodsNextFieldCallback#

    C_IteratorMethodsNextFieldCallback      ,
    IteratorMethodsNextFieldCallback        ,
    dynamic_IteratorMethodsNextFieldCallback,
    genClosure_IteratorMethodsNextFieldCallback,
    mk_IteratorMethodsNextFieldCallback     ,
    noIteratorMethodsNextFieldCallback      ,
    wrap_IteratorMethodsNextFieldCallback   ,


-- ** IteratorMethodsResetFieldCallback #signal:IteratorMethodsResetFieldCallback#

    C_IteratorMethodsResetFieldCallback     ,
    IteratorMethodsResetFieldCallback       ,
    dynamic_IteratorMethodsResetFieldCallback,
    genClosure_IteratorMethodsResetFieldCallback,
    mk_IteratorMethodsResetFieldCallback    ,
    noIteratorMethodsResetFieldCallback     ,
    wrap_IteratorMethodsResetFieldCallback  ,


-- ** PermissionMatchCallback #signal:PermissionMatchCallback#

    C_PermissionMatchCallback               ,
    PermissionMatchCallback                 ,
    PermissionMatchCallback_WithClosures    ,
    drop_closures_PermissionMatchCallback   ,
    dynamic_PermissionMatchCallback         ,
    genClosure_PermissionMatchCallback      ,
    mk_PermissionMatchCallback              ,
    noPermissionMatchCallback               ,
    noPermissionMatchCallback_WithClosures  ,
    wrap_PermissionMatchCallback            ,


-- ** RuleMatchCallback #signal:RuleMatchCallback#

    C_RuleMatchCallback                     ,
    RuleMatchCallback                       ,
    dynamic_RuleMatchCallback               ,
    mk_RuleMatchCallback                    ,
    noRuleMatchCallback                     ,


-- ** SettingsChangedCallback #signal:SettingsChangedCallback#

    C_SettingsChangedCallback               ,
    SettingsChangedCallback                 ,
    SettingsChangedCallback_WithClosures    ,
    drop_closures_SettingsChangedCallback   ,
    dynamic_SettingsChangedCallback         ,
    genClosure_SettingsChangedCallback      ,
    mk_SettingsChangedCallback              ,
    noSettingsChangedCallback               ,
    noSettingsChangedCallback_WithClosures  ,
    wrap_SettingsChangedCallback            ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GHC.Records as R
import qualified Data.Word as DW
import qualified Data.Int as DI
import qualified System.Posix.Types as SPT
import qualified Foreign.C.Types as FCT

-- Workaround for https://gitlab.haskell.org/ghc/ghc/-/issues/23392
#if MIN_VERSION_base(4,18,0)
import qualified GI.GLib.Callbacks as GLib.Callbacks
import qualified GI.GLib.Structs.MainContext as GLib.MainContext
import qualified GI.GLib.Structs.Source as GLib.Source
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Callbacks as Gio.Callbacks
import qualified GI.Gio.Interfaces.AsyncResult as Gio.AsyncResult
import qualified GI.Gio.Objects.Cancellable as Gio.Cancellable
import {-# SOURCE #-} qualified GI.Wp.Enums as Wp.Enums
import {-# SOURCE #-} qualified GI.Wp.Flags as Wp.Flags
import {-# SOURCE #-} qualified GI.Wp.Interfaces.PipewireObject as Wp.PipewireObject
import {-# SOURCE #-} qualified GI.Wp.Objects.Client as Wp.Client
import {-# SOURCE #-} qualified GI.Wp.Objects.Conf as Wp.Conf
import {-# SOURCE #-} qualified GI.Wp.Objects.Core as Wp.Core
import {-# SOURCE #-} qualified GI.Wp.Objects.DynamicRules as Wp.DynamicRules
import {-# SOURCE #-} qualified GI.Wp.Objects.GlobalProxy as Wp.GlobalProxy
import {-# SOURCE #-} qualified GI.Wp.Objects.Object as Wp.Object
import {-# SOURCE #-} qualified GI.Wp.Objects.ObjectManager as Wp.ObjectManager
import {-# SOURCE #-} qualified GI.Wp.Objects.PermissionManager as Wp.PermissionManager
import {-# SOURCE #-} qualified GI.Wp.Objects.Proxy as Wp.Proxy
import {-# SOURCE #-} qualified GI.Wp.Objects.Settings as Wp.Settings
import {-# SOURCE #-} qualified GI.Wp.Objects.SpaType as Wp.SpaType
import {-# SOURCE #-} qualified GI.Wp.Structs.Iterator as Wp.Iterator
import {-# SOURCE #-} qualified GI.Wp.Structs.IteratorMethods as Wp.IteratorMethods
import {-# SOURCE #-} qualified GI.Wp.Structs.ObjectInterest as Wp.ObjectInterest
import {-# SOURCE #-} qualified GI.Wp.Structs.Properties as Wp.Properties
import {-# SOURCE #-} qualified GI.Wp.Structs.SettingsSpec as Wp.SettingsSpec
import {-# SOURCE #-} qualified GI.Wp.Structs.SpaJson as Wp.SpaJson
import {-# SOURCE #-} qualified GI.Wp.Structs.SpaPod as Wp.SpaPod

#else
import {-# SOURCE #-} qualified GI.Wp.Objects.Client as Wp.Client
import {-# SOURCE #-} qualified GI.Wp.Objects.DynamicRules as Wp.DynamicRules
import {-# SOURCE #-} qualified GI.Wp.Objects.GlobalProxy as Wp.GlobalProxy
import {-# SOURCE #-} qualified GI.Wp.Objects.ObjectManager as Wp.ObjectManager
import {-# SOURCE #-} qualified GI.Wp.Objects.PermissionManager as Wp.PermissionManager
import {-# SOURCE #-} qualified GI.Wp.Objects.Settings as Wp.Settings
import {-# SOURCE #-} qualified GI.Wp.Structs.Iterator as Wp.Iterator
import {-# SOURCE #-} qualified GI.Wp.Structs.SpaJson as Wp.SpaJson

#endif

-- callback SettingsChangedCallback
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "obj"
          , argType =
              TInterface Name { namespace = "Wp" , name = "Settings" }
          , argCType = Just "WpSettings*"
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "setting"
          , argType = TBasicType TUTF8
          , argCType = Just "const gchar*"
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "value"
          , argType = TInterface Name { namespace = "Wp" , name = "SpaJson" }
          , argCType = Just "WpSpaJson*"
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , argCType = Just "gpointer"
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = True
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_SettingsChangedCallback =
    Ptr Wp.Settings.Settings ->
    CString ->
    Ptr Wp.SpaJson.SpaJson ->
    Ptr () ->
    IO ()

-- Args: [ Arg
--           { argCName = "obj"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Settings" }
--           , argCType = Just "WpSettings*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "setting"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const gchar*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "value"
--           , argType = TInterface Name { namespace = "Wp" , name = "SpaJson" }
--           , argCType = Just "WpSpaJson*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "gpointer"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = True
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_SettingsChangedCallback :: FunPtr C_SettingsChangedCallback -> C_SettingsChangedCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_SettingsChangedCallback ::
    (B.CallStack.HasCallStack, MonadIO m, Wp.Settings.IsSettings a) =>
    FunPtr C_SettingsChangedCallback
    -> a
    -> T.Text
    -> Wp.SpaJson.SpaJson
    -> Ptr ()
    -> m ()
dynamic_SettingsChangedCallback __funPtr obj setting value userData = liftIO $ do
    obj' <- unsafeManagedPtrCastPtr obj
    setting' <- textToCString setting
    value' <- unsafeManagedPtrGetPtr value
    (__dynamic_C_SettingsChangedCallback __funPtr) obj' setting' value' userData
    touchManagedPtr obj
    touchManagedPtr value
    freeMem setting'
    return ()

-- | Generate a function pointer callable from C code, from a `C_SettingsChangedCallback`.
foreign import ccall "wrapper"
    mk_SettingsChangedCallback :: C_SettingsChangedCallback -> IO (FunPtr C_SettingsChangedCallback)

-- | /No description available in the introspection data./
type SettingsChangedCallback =
    Wp.Settings.Settings
    -> T.Text
    -> Wp.SpaJson.SpaJson
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `SettingsChangedCallback`@.
noSettingsChangedCallback :: Maybe SettingsChangedCallback
noSettingsChangedCallback = Nothing

-- | /No description available in the introspection data./
type SettingsChangedCallback_WithClosures =
    Wp.Settings.Settings
    -> T.Text
    -> Wp.SpaJson.SpaJson
    -> Ptr ()
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `SettingsChangedCallback_WithClosures`@.
noSettingsChangedCallback_WithClosures :: Maybe SettingsChangedCallback_WithClosures
noSettingsChangedCallback_WithClosures = Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_SettingsChangedCallback :: SettingsChangedCallback -> SettingsChangedCallback_WithClosures
drop_closures_SettingsChangedCallback _f obj setting value _ = _f obj setting value

-- | Wrap the callback into a `GClosure`.
genClosure_SettingsChangedCallback :: MonadIO m => SettingsChangedCallback -> m (GClosure C_SettingsChangedCallback)
genClosure_SettingsChangedCallback cb = liftIO $ do
    let cb' = drop_closures_SettingsChangedCallback cb
    let cb'' = wrap_SettingsChangedCallback Nothing cb'
    mk_SettingsChangedCallback cb'' >>= B.GClosure.newGClosure


-- | Wrap a `SettingsChangedCallback` into a `C_SettingsChangedCallback`.
wrap_SettingsChangedCallback :: 
    Maybe (Ptr (FunPtr C_SettingsChangedCallback)) ->
    SettingsChangedCallback_WithClosures ->
    C_SettingsChangedCallback
wrap_SettingsChangedCallback gi'funptrptr gi'cb obj setting value userData = do
    obj' <- (newObject Wp.Settings.Settings) obj
    setting' <- cstringToText setting
    B.ManagedPtr.withTransient  value $ \value' -> do
        gi'cb  obj' setting' value' userData
        maybeReleaseFunPtr gi'funptrptr


-- callback RuleMatchCallback
{- Callable
  { returnType = Just (TBasicType TBoolean)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "data"
          , argType = TBasicType TPtr
          , argCType = Just "gpointer"
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "action"
          , argType = TBasicType TUTF8
          , argCType = Just "const gchar*"
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "value"
          , argType = TInterface Name { namespace = "Wp" , name = "SpaJson" }
          , argCType = Just "WpSpaJson*"
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = True
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_RuleMatchCallback =
    Ptr () ->
    CString ->
    Ptr Wp.SpaJson.SpaJson ->
    Ptr (Ptr GError) ->
    IO CInt

-- Args: [ Arg
--           { argCName = "data"
--           , argType = TBasicType TPtr
--           , argCType = Just "gpointer"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "action"
--           , argType = TBasicType TUTF8
--           , argCType = Just "const gchar*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "value"
--           , argType = TInterface Name { namespace = "Wp" , name = "SpaJson" }
--           , argCType = Just "WpSpaJson*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_RuleMatchCallback :: FunPtr C_RuleMatchCallback -> C_RuleMatchCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_RuleMatchCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_RuleMatchCallback
    -> Ptr ()
    -> T.Text
    -> Wp.SpaJson.SpaJson
    -> m ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
dynamic_RuleMatchCallback __funPtr data_ action value = liftIO $ do
    action' <- textToCString action
    value' <- unsafeManagedPtrGetPtr value
    onException (do
        _ <- propagateGError $ (__dynamic_C_RuleMatchCallback __funPtr) data_ action' value'
        touchManagedPtr value
        freeMem action'
        return ()
     ) (do
        freeMem action'
     )

-- | Generate a function pointer callable from C code, from a `C_RuleMatchCallback`.
foreign import ccall "wrapper"
    mk_RuleMatchCallback :: C_RuleMatchCallback -> IO (FunPtr C_RuleMatchCallback)

-- | /No description available in the introspection data./
type RuleMatchCallback =
    Ptr ()
    -> T.Text
    -> Wp.SpaJson.SpaJson
    -> IO ()
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/

-- | A convenience synonym for @`Nothing` :: `Maybe` `RuleMatchCallback`@.
noRuleMatchCallback :: Maybe RuleMatchCallback
noRuleMatchCallback = Nothing

-- No Haskell->C wrapper generated since the function throws.

-- callback PermissionMatchCallback
{- Callable
  { returnType = Just (TBasicType TUInt32)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "self"
          , argType =
              TInterface Name { namespace = "Wp" , name = "PermissionManager" }
          , argCType = Just "WpPermissionManager*"
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "client"
          , argType = TInterface Name { namespace = "Wp" , name = "Client" }
          , argCType = Just "WpClient*"
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "object"
          , argType =
              TInterface Name { namespace = "Wp" , name = "GlobalProxy" }
          , argCType = Just "WpGlobalProxy*"
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , argCType = Just "gpointer"
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = True
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_PermissionMatchCallback =
    Ptr Wp.PermissionManager.PermissionManager ->
    Ptr Wp.Client.Client ->
    Ptr Wp.GlobalProxy.GlobalProxy ->
    Ptr () ->
    IO Word32

-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "PermissionManager" }
--           , argCType = Just "WpPermissionManager*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "client"
--           , argType = TInterface Name { namespace = "Wp" , name = "Client" }
--           , argCType = Just "WpClient*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "object"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "GlobalProxy" }
--           , argCType = Just "WpGlobalProxy*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "gpointer"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = True
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt32)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_PermissionMatchCallback :: FunPtr C_PermissionMatchCallback -> C_PermissionMatchCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_PermissionMatchCallback ::
    (B.CallStack.HasCallStack, MonadIO m, Wp.PermissionManager.IsPermissionManager a, Wp.Client.IsClient b, Wp.GlobalProxy.IsGlobalProxy c) =>
    FunPtr C_PermissionMatchCallback
    -> a
    -> b
    -> c
    -> Ptr ()
    -> m Word32
dynamic_PermissionMatchCallback __funPtr self client object userData = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    client' <- unsafeManagedPtrCastPtr client
    object' <- unsafeManagedPtrCastPtr object
    result <- (__dynamic_C_PermissionMatchCallback __funPtr) self' client' object' userData
    touchManagedPtr self
    touchManagedPtr client
    touchManagedPtr object
    return result

-- | Generate a function pointer callable from C code, from a `C_PermissionMatchCallback`.
foreign import ccall "wrapper"
    mk_PermissionMatchCallback :: C_PermissionMatchCallback -> IO (FunPtr C_PermissionMatchCallback)

-- | /No description available in the introspection data./
type PermissionMatchCallback =
    Wp.PermissionManager.PermissionManager
    -> Wp.Client.Client
    -> Wp.GlobalProxy.GlobalProxy
    -> IO Word32

-- | A convenience synonym for @`Nothing` :: `Maybe` `PermissionMatchCallback`@.
noPermissionMatchCallback :: Maybe PermissionMatchCallback
noPermissionMatchCallback = Nothing

-- | /No description available in the introspection data./
type PermissionMatchCallback_WithClosures =
    Wp.PermissionManager.PermissionManager
    -> Wp.Client.Client
    -> Wp.GlobalProxy.GlobalProxy
    -> Ptr ()
    -> IO Word32

-- | A convenience synonym for @`Nothing` :: `Maybe` `PermissionMatchCallback_WithClosures`@.
noPermissionMatchCallback_WithClosures :: Maybe PermissionMatchCallback_WithClosures
noPermissionMatchCallback_WithClosures = Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_PermissionMatchCallback :: PermissionMatchCallback -> PermissionMatchCallback_WithClosures
drop_closures_PermissionMatchCallback _f self client object _ = _f self client object

-- | Wrap the callback into a `GClosure`.
genClosure_PermissionMatchCallback :: MonadIO m => PermissionMatchCallback -> m (GClosure C_PermissionMatchCallback)
genClosure_PermissionMatchCallback cb = liftIO $ do
    let cb' = drop_closures_PermissionMatchCallback cb
    let cb'' = wrap_PermissionMatchCallback Nothing cb'
    mk_PermissionMatchCallback cb'' >>= B.GClosure.newGClosure


-- | Wrap a `PermissionMatchCallback` into a `C_PermissionMatchCallback`.
wrap_PermissionMatchCallback :: 
    Maybe (Ptr (FunPtr C_PermissionMatchCallback)) ->
    PermissionMatchCallback_WithClosures ->
    C_PermissionMatchCallback
wrap_PermissionMatchCallback gi'funptrptr gi'cb self client object userData = do
    self' <- (newObject Wp.PermissionManager.PermissionManager) self
    client' <- (newObject Wp.Client.Client) client
    object' <- (newObject Wp.GlobalProxy.GlobalProxy) object
    result <- gi'cb  self' client' object' userData
    maybeReleaseFunPtr gi'funptrptr
    return result


-- callback IteratorMethodsResetFieldCallback
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "self"
          , argType =
              TInterface Name { namespace = "Wp" , name = "Iterator" }
          , argCType = Just "WpIterator*"
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_IteratorMethodsResetFieldCallback =
    Ptr Wp.Iterator.Iterator ->
    IO ()

-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Iterator" }
--           , argCType = Just "WpIterator*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_IteratorMethodsResetFieldCallback :: FunPtr C_IteratorMethodsResetFieldCallback -> C_IteratorMethodsResetFieldCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_IteratorMethodsResetFieldCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_IteratorMethodsResetFieldCallback
    -> Wp.Iterator.Iterator
    -> m ()
dynamic_IteratorMethodsResetFieldCallback __funPtr self = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    (__dynamic_C_IteratorMethodsResetFieldCallback __funPtr) self'
    touchManagedPtr self
    return ()

-- | Generate a function pointer callable from C code, from a `C_IteratorMethodsResetFieldCallback`.
foreign import ccall "wrapper"
    mk_IteratorMethodsResetFieldCallback :: C_IteratorMethodsResetFieldCallback -> IO (FunPtr C_IteratorMethodsResetFieldCallback)

-- | /No description available in the introspection data./
type IteratorMethodsResetFieldCallback =
    Wp.Iterator.Iterator
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `IteratorMethodsResetFieldCallback`@.
noIteratorMethodsResetFieldCallback :: Maybe IteratorMethodsResetFieldCallback
noIteratorMethodsResetFieldCallback = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_IteratorMethodsResetFieldCallback :: MonadIO m => IteratorMethodsResetFieldCallback -> m (GClosure C_IteratorMethodsResetFieldCallback)
genClosure_IteratorMethodsResetFieldCallback cb = liftIO $ do
    let cb' = wrap_IteratorMethodsResetFieldCallback Nothing cb
    mk_IteratorMethodsResetFieldCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `IteratorMethodsResetFieldCallback` into a `C_IteratorMethodsResetFieldCallback`.
wrap_IteratorMethodsResetFieldCallback :: 
    Maybe (Ptr (FunPtr C_IteratorMethodsResetFieldCallback)) ->
    IteratorMethodsResetFieldCallback ->
    C_IteratorMethodsResetFieldCallback
wrap_IteratorMethodsResetFieldCallback gi'funptrptr gi'cb self = do
    B.ManagedPtr.withTransient  self $ \self' -> do
        gi'cb  self'
        maybeReleaseFunPtr gi'funptrptr


-- callback IteratorMethodsNextFieldCallback
{- Callable
  { returnType = Just (TBasicType TBoolean)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "self"
          , argType =
              TInterface Name { namespace = "Wp" , name = "Iterator" }
          , argCType = Just "WpIterator*"
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "item"
          , argType = TGValue
          , argCType = Just "GValue*"
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_IteratorMethodsNextFieldCallback =
    Ptr Wp.Iterator.Iterator ->
    Ptr GValue ->
    IO CInt

-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Iterator" }
--           , argCType = Just "WpIterator*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "item"
--           , argType = TGValue
--           , argCType = Just "GValue*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_IteratorMethodsNextFieldCallback :: FunPtr C_IteratorMethodsNextFieldCallback -> C_IteratorMethodsNextFieldCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_IteratorMethodsNextFieldCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_IteratorMethodsNextFieldCallback
    -> Wp.Iterator.Iterator
    -> GValue
    -> m Bool
dynamic_IteratorMethodsNextFieldCallback __funPtr self item = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    item' <- unsafeManagedPtrGetPtr item
    result <- (__dynamic_C_IteratorMethodsNextFieldCallback __funPtr) self' item'
    let result' = (/= 0) result
    touchManagedPtr self
    touchManagedPtr item
    return result'

-- | Generate a function pointer callable from C code, from a `C_IteratorMethodsNextFieldCallback`.
foreign import ccall "wrapper"
    mk_IteratorMethodsNextFieldCallback :: C_IteratorMethodsNextFieldCallback -> IO (FunPtr C_IteratorMethodsNextFieldCallback)

-- | /No description available in the introspection data./
type IteratorMethodsNextFieldCallback =
    Wp.Iterator.Iterator
    -> GValue
    -> IO Bool

-- | A convenience synonym for @`Nothing` :: `Maybe` `IteratorMethodsNextFieldCallback`@.
noIteratorMethodsNextFieldCallback :: Maybe IteratorMethodsNextFieldCallback
noIteratorMethodsNextFieldCallback = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_IteratorMethodsNextFieldCallback :: MonadIO m => IteratorMethodsNextFieldCallback -> m (GClosure C_IteratorMethodsNextFieldCallback)
genClosure_IteratorMethodsNextFieldCallback cb = liftIO $ do
    let cb' = wrap_IteratorMethodsNextFieldCallback Nothing cb
    mk_IteratorMethodsNextFieldCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `IteratorMethodsNextFieldCallback` into a `C_IteratorMethodsNextFieldCallback`.
wrap_IteratorMethodsNextFieldCallback :: 
    Maybe (Ptr (FunPtr C_IteratorMethodsNextFieldCallback)) ->
    IteratorMethodsNextFieldCallback ->
    C_IteratorMethodsNextFieldCallback
wrap_IteratorMethodsNextFieldCallback gi'funptrptr gi'cb self item = do
    B.ManagedPtr.withTransient  self $ \self' -> do
        item' <- B.GValue.newGValueFromPtr item
        result <- gi'cb  self' item'
        maybeReleaseFunPtr gi'funptrptr
        let result' = (P.fromIntegral . P.fromEnum) result
        return result'


-- callback IteratorMethodsFinalizeFieldCallback
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "self"
          , argType =
              TInterface Name { namespace = "Wp" , name = "Iterator" }
          , argCType = Just "WpIterator*"
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_IteratorMethodsFinalizeFieldCallback =
    Ptr Wp.Iterator.Iterator ->
    IO ()

-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "Iterator" }
--           , argCType = Just "WpIterator*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_IteratorMethodsFinalizeFieldCallback :: FunPtr C_IteratorMethodsFinalizeFieldCallback -> C_IteratorMethodsFinalizeFieldCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_IteratorMethodsFinalizeFieldCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_IteratorMethodsFinalizeFieldCallback
    -> Wp.Iterator.Iterator
    -> m ()
dynamic_IteratorMethodsFinalizeFieldCallback __funPtr self = liftIO $ do
    self' <- unsafeManagedPtrGetPtr self
    (__dynamic_C_IteratorMethodsFinalizeFieldCallback __funPtr) self'
    touchManagedPtr self
    return ()

-- | Generate a function pointer callable from C code, from a `C_IteratorMethodsFinalizeFieldCallback`.
foreign import ccall "wrapper"
    mk_IteratorMethodsFinalizeFieldCallback :: C_IteratorMethodsFinalizeFieldCallback -> IO (FunPtr C_IteratorMethodsFinalizeFieldCallback)

-- | /No description available in the introspection data./
type IteratorMethodsFinalizeFieldCallback =
    Wp.Iterator.Iterator
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `IteratorMethodsFinalizeFieldCallback`@.
noIteratorMethodsFinalizeFieldCallback :: Maybe IteratorMethodsFinalizeFieldCallback
noIteratorMethodsFinalizeFieldCallback = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_IteratorMethodsFinalizeFieldCallback :: MonadIO m => IteratorMethodsFinalizeFieldCallback -> m (GClosure C_IteratorMethodsFinalizeFieldCallback)
genClosure_IteratorMethodsFinalizeFieldCallback cb = liftIO $ do
    let cb' = wrap_IteratorMethodsFinalizeFieldCallback Nothing cb
    mk_IteratorMethodsFinalizeFieldCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `IteratorMethodsFinalizeFieldCallback` into a `C_IteratorMethodsFinalizeFieldCallback`.
wrap_IteratorMethodsFinalizeFieldCallback :: 
    Maybe (Ptr (FunPtr C_IteratorMethodsFinalizeFieldCallback)) ->
    IteratorMethodsFinalizeFieldCallback ->
    C_IteratorMethodsFinalizeFieldCallback
wrap_IteratorMethodsFinalizeFieldCallback gi'funptrptr gi'cb self = do
    B.ManagedPtr.withTransient  self $ \self' -> do
        gi'cb  self'
        maybeReleaseFunPtr gi'funptrptr


-- callback IteratorForeachFunc
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "item"
          , argType = TGValue
          , argCType = Just "const GValue*"
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "data"
          , argType = TBasicType TPtr
          , argCType = Just "gpointer"
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_IteratorForeachFunc =
    Ptr GValue ->
    Ptr () ->
    IO ()

-- Args: [ Arg
--           { argCName = "item"
--           , argType = TGValue
--           , argCType = Just "const GValue*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "data"
--           , argType = TBasicType TPtr
--           , argCType = Just "gpointer"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_IteratorForeachFunc :: FunPtr C_IteratorForeachFunc -> C_IteratorForeachFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_IteratorForeachFunc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_IteratorForeachFunc
    -> GValue
    -> Ptr ()
    -> m ()
dynamic_IteratorForeachFunc __funPtr item data_ = liftIO $ do
    item' <- unsafeManagedPtrGetPtr item
    (__dynamic_C_IteratorForeachFunc __funPtr) item' data_
    touchManagedPtr item
    return ()

-- | Generate a function pointer callable from C code, from a `C_IteratorForeachFunc`.
foreign import ccall "wrapper"
    mk_IteratorForeachFunc :: C_IteratorForeachFunc -> IO (FunPtr C_IteratorForeachFunc)

-- | /No description available in the introspection data./
type IteratorForeachFunc =
    GValue
    -> Ptr ()
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `IteratorForeachFunc`@.
noIteratorForeachFunc :: Maybe IteratorForeachFunc
noIteratorForeachFunc = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_IteratorForeachFunc :: MonadIO m => IteratorForeachFunc -> m (GClosure C_IteratorForeachFunc)
genClosure_IteratorForeachFunc cb = liftIO $ do
    let cb' = wrap_IteratorForeachFunc Nothing cb
    mk_IteratorForeachFunc cb' >>= B.GClosure.newGClosure


-- | Wrap a `IteratorForeachFunc` into a `C_IteratorForeachFunc`.
wrap_IteratorForeachFunc :: 
    Maybe (Ptr (FunPtr C_IteratorForeachFunc)) ->
    IteratorForeachFunc ->
    C_IteratorForeachFunc
wrap_IteratorForeachFunc gi'funptrptr gi'cb item data_ = do
    item' <- B.GValue.newGValueFromPtr item
    gi'cb  item' data_
    maybeReleaseFunPtr gi'funptrptr


-- callback IteratorFoldFunc
{- Callable
  { returnType = Just (TBasicType TBoolean)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "item"
          , argType = TGValue
          , argCType = Just "const GValue*"
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "ret"
          , argType = TGValue
          , argCType = Just "GValue*"
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "data"
          , argType = TBasicType TPtr
          , argCType = Just "gpointer"
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_IteratorFoldFunc =
    Ptr GValue ->
    Ptr GValue ->
    Ptr () ->
    IO CInt

-- Args: [ Arg
--           { argCName = "item"
--           , argType = TGValue
--           , argCType = Just "const GValue*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "ret"
--           , argType = TGValue
--           , argCType = Just "GValue*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "data"
--           , argType = TBasicType TPtr
--           , argCType = Just "gpointer"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_IteratorFoldFunc :: FunPtr C_IteratorFoldFunc -> C_IteratorFoldFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_IteratorFoldFunc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_IteratorFoldFunc
    -> GValue
    -> GValue
    -> Ptr ()
    -> m Bool
dynamic_IteratorFoldFunc __funPtr item ret data_ = liftIO $ do
    item' <- unsafeManagedPtrGetPtr item
    ret' <- unsafeManagedPtrGetPtr ret
    result <- (__dynamic_C_IteratorFoldFunc __funPtr) item' ret' data_
    let result' = (/= 0) result
    touchManagedPtr item
    touchManagedPtr ret
    return result'

-- | Generate a function pointer callable from C code, from a `C_IteratorFoldFunc`.
foreign import ccall "wrapper"
    mk_IteratorFoldFunc :: C_IteratorFoldFunc -> IO (FunPtr C_IteratorFoldFunc)

-- | /No description available in the introspection data./
type IteratorFoldFunc =
    GValue
    -> GValue
    -> Ptr ()
    -> IO Bool

-- | A convenience synonym for @`Nothing` :: `Maybe` `IteratorFoldFunc`@.
noIteratorFoldFunc :: Maybe IteratorFoldFunc
noIteratorFoldFunc = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_IteratorFoldFunc :: MonadIO m => IteratorFoldFunc -> m (GClosure C_IteratorFoldFunc)
genClosure_IteratorFoldFunc cb = liftIO $ do
    let cb' = wrap_IteratorFoldFunc Nothing cb
    mk_IteratorFoldFunc cb' >>= B.GClosure.newGClosure


-- | Wrap a `IteratorFoldFunc` into a `C_IteratorFoldFunc`.
wrap_IteratorFoldFunc :: 
    Maybe (Ptr (FunPtr C_IteratorFoldFunc)) ->
    IteratorFoldFunc ->
    C_IteratorFoldFunc
wrap_IteratorFoldFunc gi'funptrptr gi'cb item ret data_ = do
    item' <- B.GValue.newGValueFromPtr item
    ret' <- B.GValue.newGValueFromPtr ret
    result <- gi'cb  item' ret' data_
    maybeReleaseFunPtr gi'funptrptr
    let result' = (P.fromIntegral . P.fromEnum) result
    return result'


-- callback DynamicRulesConditionCallback
{- Callable
  { returnType = Just (TBasicType TBoolean)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "self"
          , argType =
              TInterface Name { namespace = "Wp" , name = "DynamicRules" }
          , argCType = Just "WpDynamicRules*"
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "subject"
          , argType =
              TInterface Name { namespace = "Wp" , name = "GlobalProxy" }
          , argCType = Just "WpGlobalProxy*"
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "condition_om"
          , argType =
              TInterface Name { namespace = "Wp" , name = "ObjectManager" }
          , argCType = Just "WpObjectManager*"
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , argCType = Just "gpointer"
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation { rawDocText = Nothing , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = True
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_DynamicRulesConditionCallback =
    Ptr Wp.DynamicRules.DynamicRules ->
    Ptr Wp.GlobalProxy.GlobalProxy ->
    Ptr Wp.ObjectManager.ObjectManager ->
    Ptr () ->
    IO CInt

-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "DynamicRules" }
--           , argCType = Just "WpDynamicRules*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "subject"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "GlobalProxy" }
--           , argCType = Just "WpGlobalProxy*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "condition_om"
--           , argType =
--               TInterface Name { namespace = "Wp" , name = "ObjectManager" }
--           , argCType = Just "WpObjectManager*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "gpointer"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = True
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_DynamicRulesConditionCallback :: FunPtr C_DynamicRulesConditionCallback -> C_DynamicRulesConditionCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_DynamicRulesConditionCallback ::
    (B.CallStack.HasCallStack, MonadIO m, Wp.DynamicRules.IsDynamicRules a, Wp.GlobalProxy.IsGlobalProxy b, Wp.ObjectManager.IsObjectManager c) =>
    FunPtr C_DynamicRulesConditionCallback
    -> a
    -> b
    -> c
    -> Ptr ()
    -> m Bool
dynamic_DynamicRulesConditionCallback __funPtr self subject conditionOm userData = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    subject' <- unsafeManagedPtrCastPtr subject
    conditionOm' <- unsafeManagedPtrCastPtr conditionOm
    result <- (__dynamic_C_DynamicRulesConditionCallback __funPtr) self' subject' conditionOm' userData
    let result' = (/= 0) result
    touchManagedPtr self
    touchManagedPtr subject
    touchManagedPtr conditionOm
    return result'

-- | Generate a function pointer callable from C code, from a `C_DynamicRulesConditionCallback`.
foreign import ccall "wrapper"
    mk_DynamicRulesConditionCallback :: C_DynamicRulesConditionCallback -> IO (FunPtr C_DynamicRulesConditionCallback)

-- | /No description available in the introspection data./
type DynamicRulesConditionCallback =
    Wp.DynamicRules.DynamicRules
    -> Wp.GlobalProxy.GlobalProxy
    -> Wp.ObjectManager.ObjectManager
    -> IO Bool

-- | A convenience synonym for @`Nothing` :: `Maybe` `DynamicRulesConditionCallback`@.
noDynamicRulesConditionCallback :: Maybe DynamicRulesConditionCallback
noDynamicRulesConditionCallback = Nothing

-- | /No description available in the introspection data./
type DynamicRulesConditionCallback_WithClosures =
    Wp.DynamicRules.DynamicRules
    -> Wp.GlobalProxy.GlobalProxy
    -> Wp.ObjectManager.ObjectManager
    -> Ptr ()
    -> IO Bool

-- | A convenience synonym for @`Nothing` :: `Maybe` `DynamicRulesConditionCallback_WithClosures`@.
noDynamicRulesConditionCallback_WithClosures :: Maybe DynamicRulesConditionCallback_WithClosures
noDynamicRulesConditionCallback_WithClosures = Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_DynamicRulesConditionCallback :: DynamicRulesConditionCallback -> DynamicRulesConditionCallback_WithClosures
drop_closures_DynamicRulesConditionCallback _f self subject conditionOm _ = _f self subject conditionOm

-- | Wrap the callback into a `GClosure`.
genClosure_DynamicRulesConditionCallback :: MonadIO m => DynamicRulesConditionCallback -> m (GClosure C_DynamicRulesConditionCallback)
genClosure_DynamicRulesConditionCallback cb = liftIO $ do
    let cb' = drop_closures_DynamicRulesConditionCallback cb
    let cb'' = wrap_DynamicRulesConditionCallback Nothing cb'
    mk_DynamicRulesConditionCallback cb'' >>= B.GClosure.newGClosure


-- | Wrap a `DynamicRulesConditionCallback` into a `C_DynamicRulesConditionCallback`.
wrap_DynamicRulesConditionCallback :: 
    Maybe (Ptr (FunPtr C_DynamicRulesConditionCallback)) ->
    DynamicRulesConditionCallback_WithClosures ->
    C_DynamicRulesConditionCallback
wrap_DynamicRulesConditionCallback gi'funptrptr gi'cb self subject conditionOm userData = do
    self' <- (newObject Wp.DynamicRules.DynamicRules) self
    subject' <- (newObject Wp.GlobalProxy.GlobalProxy) subject
    conditionOm' <- (newObject Wp.ObjectManager.ObjectManager) conditionOm
    result <- gi'cb  self' subject' conditionOm' userData
    maybeReleaseFunPtr gi'funptrptr
    let result' = (P.fromIntegral . P.fromEnum) result
    return result'



