{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)

/No description available in the introspection data./
-}

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

module GI.Soup.Objects.AuthDomainBasic
    (

-- * Exported types
    AuthDomainBasic(..)                     ,
    IsAuthDomainBasic                       ,
    toAuthDomainBasic                       ,
    noAuthDomainBasic                       ,


 -- * Methods
-- ** setAuthCallback #method:setAuthCallback#

#if ENABLE_OVERLOADING
    AuthDomainBasicSetAuthCallbackMethodInfo,
#endif
    authDomainBasicSetAuthCallback          ,




 -- * Properties
-- ** authCallback #attr:authCallback#
{- | The 'GI.Soup.Callbacks.AuthDomainBasicAuthCallback'
-}
#if ENABLE_OVERLOADING
    AuthDomainBasicAuthCallbackPropertyInfo ,
#endif
#if ENABLE_OVERLOADING
    authDomainBasicAuthCallback             ,
#endif
    clearAuthDomainBasicAuthCallback        ,
    constructAuthDomainBasicAuthCallback    ,
    getAuthDomainBasicAuthCallback          ,
    setAuthDomainBasicAuthCallback          ,


-- ** authData #attr:authData#
{- | The data to pass to the 'GI.Soup.Callbacks.AuthDomainBasicAuthCallback'
-}
#if ENABLE_OVERLOADING
    AuthDomainBasicAuthDataPropertyInfo     ,
#endif
#if ENABLE_OVERLOADING
    authDomainBasicAuthData                 ,
#endif
    constructAuthDomainBasicAuthData        ,
    getAuthDomainBasicAuthData              ,
    setAuthDomainBasicAuthData              ,




    ) 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.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
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.Text as T
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 GI.GLib.Callbacks as GLib.Callbacks
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Soup.Callbacks as Soup.Callbacks
import {-# SOURCE #-} qualified GI.Soup.Objects.AuthDomain as Soup.AuthDomain

-- | Memory-managed wrapper type.
newtype AuthDomainBasic = AuthDomainBasic (ManagedPtr AuthDomainBasic)
foreign import ccall "soup_auth_domain_basic_get_type"
    c_soup_auth_domain_basic_get_type :: IO GType

instance GObject AuthDomainBasic where
    gobjectType = c_soup_auth_domain_basic_get_type


-- | Type class for types which can be safely cast to `AuthDomainBasic`, for instance with `toAuthDomainBasic`.
class (GObject o, O.IsDescendantOf AuthDomainBasic o) => IsAuthDomainBasic o
instance (GObject o, O.IsDescendantOf AuthDomainBasic o) => IsAuthDomainBasic o

instance O.HasParentTypes AuthDomainBasic
type instance O.ParentTypes AuthDomainBasic = '[Soup.AuthDomain.AuthDomain, GObject.Object.Object]

-- | Cast to `AuthDomainBasic`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toAuthDomainBasic :: (MonadIO m, IsAuthDomainBasic o) => o -> m AuthDomainBasic
toAuthDomainBasic = liftIO . unsafeCastTo AuthDomainBasic

-- | A convenience alias for `Nothing` :: `Maybe` `AuthDomainBasic`.
noAuthDomainBasic :: Maybe AuthDomainBasic
noAuthDomainBasic = Nothing

#if ENABLE_OVERLOADING
type family ResolveAuthDomainBasicMethod (t :: Symbol) (o :: *) :: * where
    ResolveAuthDomainBasicMethod "accepts" o = Soup.AuthDomain.AuthDomainAcceptsMethodInfo
    ResolveAuthDomainBasicMethod "addPath" o = Soup.AuthDomain.AuthDomainAddPathMethodInfo
    ResolveAuthDomainBasicMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveAuthDomainBasicMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveAuthDomainBasicMethod "challenge" o = Soup.AuthDomain.AuthDomainChallengeMethodInfo
    ResolveAuthDomainBasicMethod "checkPassword" o = Soup.AuthDomain.AuthDomainCheckPasswordMethodInfo
    ResolveAuthDomainBasicMethod "covers" o = Soup.AuthDomain.AuthDomainCoversMethodInfo
    ResolveAuthDomainBasicMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveAuthDomainBasicMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveAuthDomainBasicMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveAuthDomainBasicMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveAuthDomainBasicMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveAuthDomainBasicMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveAuthDomainBasicMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveAuthDomainBasicMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveAuthDomainBasicMethod "removePath" o = Soup.AuthDomain.AuthDomainRemovePathMethodInfo
    ResolveAuthDomainBasicMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveAuthDomainBasicMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveAuthDomainBasicMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveAuthDomainBasicMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveAuthDomainBasicMethod "tryGenericAuthCallback" o = Soup.AuthDomain.AuthDomainTryGenericAuthCallbackMethodInfo
    ResolveAuthDomainBasicMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveAuthDomainBasicMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveAuthDomainBasicMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveAuthDomainBasicMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveAuthDomainBasicMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveAuthDomainBasicMethod "getRealm" o = Soup.AuthDomain.AuthDomainGetRealmMethodInfo
    ResolveAuthDomainBasicMethod "setAuthCallback" o = AuthDomainBasicSetAuthCallbackMethodInfo
    ResolveAuthDomainBasicMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveAuthDomainBasicMethod "setFilter" o = Soup.AuthDomain.AuthDomainSetFilterMethodInfo
    ResolveAuthDomainBasicMethod "setGenericAuthCallback" o = Soup.AuthDomain.AuthDomainSetGenericAuthCallbackMethodInfo
    ResolveAuthDomainBasicMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveAuthDomainBasicMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveAuthDomainBasicMethod t AuthDomainBasic, O.MethodInfo info AuthDomainBasic p) => OL.IsLabel t (AuthDomainBasic -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

#endif

-- VVV Prop "auth-callback"
   -- Type: TInterface (Name {namespace = "Soup", name = "AuthDomainBasicAuthCallback"})
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Nothing)

{- |
Get the value of the “@auth-callback@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' authDomainBasic #authCallback
@
-}
getAuthDomainBasicAuthCallback :: (MonadIO m, IsAuthDomainBasic o) => o -> m (Maybe Soup.Callbacks.AuthDomainBasicAuthCallback_WithClosures)
getAuthDomainBasicAuthCallback obj = liftIO $ B.Properties.getObjectPropertyCallback obj "auth-callback" Soup.Callbacks.dynamic_AuthDomainBasicAuthCallback

{- |
Set the value of the “@auth-callback@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' authDomainBasic [ #authCallback 'Data.GI.Base.Attributes.:=' value ]
@
-}
setAuthDomainBasicAuthCallback :: (MonadIO m, IsAuthDomainBasic o) => o -> FunPtr Soup.Callbacks.C_AuthDomainBasicAuthCallback -> m ()
setAuthDomainBasicAuthCallback obj val = liftIO $ B.Properties.setObjectPropertyCallback obj "auth-callback" val

{- |
Construct a `GValueConstruct` with valid value for the “@auth-callback@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructAuthDomainBasicAuthCallback :: (IsAuthDomainBasic o) => FunPtr Soup.Callbacks.C_AuthDomainBasicAuthCallback -> IO (GValueConstruct o)
constructAuthDomainBasicAuthCallback val = B.Properties.constructObjectPropertyCallback "auth-callback" val

{- |
Set the value of the “@auth-callback@” property to `Nothing`.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.clear' #authCallback
@
-}
clearAuthDomainBasicAuthCallback :: (MonadIO m, IsAuthDomainBasic o) => o -> m ()
clearAuthDomainBasicAuthCallback obj = liftIO $ B.Properties.setObjectPropertyCallback obj "auth-callback" FP.nullFunPtr

#if ENABLE_OVERLOADING
data AuthDomainBasicAuthCallbackPropertyInfo
instance AttrInfo AuthDomainBasicAuthCallbackPropertyInfo where
    type AttrAllowedOps AuthDomainBasicAuthCallbackPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint AuthDomainBasicAuthCallbackPropertyInfo = (~) (FunPtr Soup.Callbacks.C_AuthDomainBasicAuthCallback)
    type AttrBaseTypeConstraint AuthDomainBasicAuthCallbackPropertyInfo = IsAuthDomainBasic
    type AttrGetType AuthDomainBasicAuthCallbackPropertyInfo = (Maybe Soup.Callbacks.AuthDomainBasicAuthCallback_WithClosures)
    type AttrLabel AuthDomainBasicAuthCallbackPropertyInfo = "auth-callback"
    type AttrOrigin AuthDomainBasicAuthCallbackPropertyInfo = AuthDomainBasic
    attrGet _ = getAuthDomainBasicAuthCallback
    attrSet _ = setAuthDomainBasicAuthCallback
    attrConstruct _ = constructAuthDomainBasicAuthCallback
    attrClear _ = clearAuthDomainBasicAuthCallback
#endif

-- VVV Prop "auth-data"
   -- Type: TBasicType TPtr
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Nothing)

{- |
Get the value of the “@auth-data@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' authDomainBasic #authData
@
-}
getAuthDomainBasicAuthData :: (MonadIO m, IsAuthDomainBasic o) => o -> m (Ptr ())
getAuthDomainBasicAuthData obj = liftIO $ B.Properties.getObjectPropertyPtr obj "auth-data"

{- |
Set the value of the “@auth-data@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' authDomainBasic [ #authData 'Data.GI.Base.Attributes.:=' value ]
@
-}
setAuthDomainBasicAuthData :: (MonadIO m, IsAuthDomainBasic o) => o -> Ptr () -> m ()
setAuthDomainBasicAuthData obj val = liftIO $ B.Properties.setObjectPropertyPtr obj "auth-data" val

{- |
Construct a `GValueConstruct` with valid value for the “@auth-data@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructAuthDomainBasicAuthData :: (IsAuthDomainBasic o) => Ptr () -> IO (GValueConstruct o)
constructAuthDomainBasicAuthData val = B.Properties.constructObjectPropertyPtr "auth-data" val

#if ENABLE_OVERLOADING
data AuthDomainBasicAuthDataPropertyInfo
instance AttrInfo AuthDomainBasicAuthDataPropertyInfo where
    type AttrAllowedOps AuthDomainBasicAuthDataPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint AuthDomainBasicAuthDataPropertyInfo = (~) (Ptr ())
    type AttrBaseTypeConstraint AuthDomainBasicAuthDataPropertyInfo = IsAuthDomainBasic
    type AttrGetType AuthDomainBasicAuthDataPropertyInfo = (Ptr ())
    type AttrLabel AuthDomainBasicAuthDataPropertyInfo = "auth-data"
    type AttrOrigin AuthDomainBasicAuthDataPropertyInfo = AuthDomainBasic
    attrGet _ = getAuthDomainBasicAuthData
    attrSet _ = setAuthDomainBasicAuthData
    attrConstruct _ = constructAuthDomainBasicAuthData
    attrClear _ = undefined
#endif

#if ENABLE_OVERLOADING
instance O.HasAttributeList AuthDomainBasic
type instance O.AttributeList AuthDomainBasic = AuthDomainBasicAttributeList
type AuthDomainBasicAttributeList = ('[ '("addPath", Soup.AuthDomain.AuthDomainAddPathPropertyInfo), '("authCallback", AuthDomainBasicAuthCallbackPropertyInfo), '("authData", AuthDomainBasicAuthDataPropertyInfo), '("filter", Soup.AuthDomain.AuthDomainFilterPropertyInfo), '("filterData", Soup.AuthDomain.AuthDomainFilterDataPropertyInfo), '("genericAuthCallback", Soup.AuthDomain.AuthDomainGenericAuthCallbackPropertyInfo), '("genericAuthData", Soup.AuthDomain.AuthDomainGenericAuthDataPropertyInfo), '("proxy", Soup.AuthDomain.AuthDomainProxyPropertyInfo), '("realm", Soup.AuthDomain.AuthDomainRealmPropertyInfo), '("removePath", Soup.AuthDomain.AuthDomainRemovePathPropertyInfo)] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
authDomainBasicAuthCallback :: AttrLabelProxy "authCallback"
authDomainBasicAuthCallback = AttrLabelProxy

authDomainBasicAuthData :: AttrLabelProxy "authData"
authDomainBasicAuthData = AttrLabelProxy

#endif

#if ENABLE_OVERLOADING
type instance O.SignalList AuthDomainBasic = AuthDomainBasicSignalList
type AuthDomainBasicSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

-- method AuthDomainBasic::set_auth_callback
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "domain", argType = TInterface (Name {namespace = "Soup", name = "AuthDomainBasic"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the domain", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "callback", argType = TInterface (Name {namespace = "Soup", name = "AuthDomainBasicAuthCallback"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the callback", sinceVersion = Nothing}, argScope = ScopeTypeNotified, argClosure = 2, argDestroy = 3, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "data to pass to @auth_callback", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "dnotify", argType = TInterface (Name {namespace = "GLib", name = "DestroyNotify"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "destroy notifier to free @user_data when @domain\nis destroyed", sinceVersion = Nothing}, argScope = ScopeTypeAsync, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "soup_auth_domain_basic_set_auth_callback" soup_auth_domain_basic_set_auth_callback ::
    Ptr AuthDomainBasic ->                  -- domain : TInterface (Name {namespace = "Soup", name = "AuthDomainBasic"})
    FunPtr Soup.Callbacks.C_AuthDomainBasicAuthCallback -> -- callback : TInterface (Name {namespace = "Soup", name = "AuthDomainBasicAuthCallback"})
    Ptr () ->                               -- user_data : TBasicType TPtr
    FunPtr GLib.Callbacks.C_DestroyNotify -> -- dnotify : TInterface (Name {namespace = "GLib", name = "DestroyNotify"})
    IO ()

{- |
Sets the callback that /@domain@/ will use to authenticate incoming
requests. For each request containing authorization, /@domain@/ will
invoke the callback, and then either accept or reject the request
based on /@callback@/\'s return value.

You can also set the auth callback by setting the
'GI.Soup.Constants.AUTH_DOMAIN_BASIC_AUTH_CALLBACK' and
'GI.Soup.Constants.AUTH_DOMAIN_BASIC_AUTH_DATA' properties, which can also be
used to set the callback at construct time.
-}
authDomainBasicSetAuthCallback ::
    (B.CallStack.HasCallStack, MonadIO m, IsAuthDomainBasic a) =>
    a
    {- ^ /@domain@/: the domain -}
    -> Soup.Callbacks.AuthDomainBasicAuthCallback
    {- ^ /@callback@/: the callback -}
    -> m ()
authDomainBasicSetAuthCallback domain callback = liftIO $ do
    domain' <- unsafeManagedPtrCastPtr domain
    callback' <- Soup.Callbacks.mk_AuthDomainBasicAuthCallback (Soup.Callbacks.wrap_AuthDomainBasicAuthCallback Nothing (Soup.Callbacks.drop_closures_AuthDomainBasicAuthCallback callback))
    let userData = castFunPtrToPtr callback'
    let dnotify = safeFreeFunPtrPtr
    soup_auth_domain_basic_set_auth_callback domain' callback' userData dnotify
    touchManagedPtr domain
    return ()

#if ENABLE_OVERLOADING
data AuthDomainBasicSetAuthCallbackMethodInfo
instance (signature ~ (Soup.Callbacks.AuthDomainBasicAuthCallback -> m ()), MonadIO m, IsAuthDomainBasic a) => O.MethodInfo AuthDomainBasicSetAuthCallbackMethodInfo a signature where
    overloadedMethod _ = authDomainBasicSetAuthCallback

#endif