{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- /No description available in the introspection data./

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

module GI.Soup.Objects.AuthNegotiate
    ( 

-- * Exported types
    AuthNegotiate(..)                       ,
    IsAuthNegotiate                         ,
    toAuthNegotiate                         ,


 -- * Methods
-- ** Overloaded methods #method:Overloaded methods#

#if defined(ENABLE_OVERLOADING)
    ResolveAuthNegotiateMethod              ,
#endif


-- ** supported #method:supported#

    authNegotiateSupported                  ,




    ) 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.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.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
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.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Soup.Objects.Auth as Soup.Auth

-- | Memory-managed wrapper type.
newtype AuthNegotiate = AuthNegotiate (SP.ManagedPtr AuthNegotiate)
    deriving (AuthNegotiate -> AuthNegotiate -> Bool
(AuthNegotiate -> AuthNegotiate -> Bool)
-> (AuthNegotiate -> AuthNegotiate -> Bool) -> Eq AuthNegotiate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AuthNegotiate -> AuthNegotiate -> Bool
$c/= :: AuthNegotiate -> AuthNegotiate -> Bool
== :: AuthNegotiate -> AuthNegotiate -> Bool
$c== :: AuthNegotiate -> AuthNegotiate -> Bool
Eq)

instance SP.ManagedPtrNewtype AuthNegotiate where
    toManagedPtr :: AuthNegotiate -> ManagedPtr AuthNegotiate
toManagedPtr (AuthNegotiate ManagedPtr AuthNegotiate
p) = ManagedPtr AuthNegotiate
p

foreign import ccall "soup_auth_negotiate_get_type"
    c_soup_auth_negotiate_get_type :: IO B.Types.GType

instance B.Types.TypedObject AuthNegotiate where
    glibType :: IO GType
glibType = IO GType
c_soup_auth_negotiate_get_type

instance B.Types.GObject AuthNegotiate

-- | Convert 'AuthNegotiate' to and from 'Data.GI.Base.GValue.GValue' with 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue AuthNegotiate where
    toGValue :: AuthNegotiate -> IO GValue
toGValue AuthNegotiate
o = do
        GType
gtype <- IO GType
c_soup_auth_negotiate_get_type
        AuthNegotiate -> (Ptr AuthNegotiate -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr AuthNegotiate
o (GType
-> (GValue -> Ptr AuthNegotiate -> IO ())
-> Ptr AuthNegotiate
-> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr AuthNegotiate -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
        
    fromGValue :: GValue -> IO AuthNegotiate
fromGValue GValue
gv = do
        Ptr AuthNegotiate
ptr <- GValue -> IO (Ptr AuthNegotiate)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr AuthNegotiate)
        (ManagedPtr AuthNegotiate -> AuthNegotiate)
-> Ptr AuthNegotiate -> IO AuthNegotiate
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr AuthNegotiate -> AuthNegotiate
AuthNegotiate Ptr AuthNegotiate
ptr
        
    

-- | Type class for types which can be safely cast to `AuthNegotiate`, for instance with `toAuthNegotiate`.
class (SP.GObject o, O.IsDescendantOf AuthNegotiate o) => IsAuthNegotiate o
instance (SP.GObject o, O.IsDescendantOf AuthNegotiate o) => IsAuthNegotiate o

instance O.HasParentTypes AuthNegotiate
type instance O.ParentTypes AuthNegotiate = '[Soup.Auth.Auth, GObject.Object.Object]

-- | Cast to `AuthNegotiate`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toAuthNegotiate :: (MonadIO m, IsAuthNegotiate o) => o -> m AuthNegotiate
toAuthNegotiate :: o -> m AuthNegotiate
toAuthNegotiate = IO AuthNegotiate -> m AuthNegotiate
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO AuthNegotiate -> m AuthNegotiate)
-> (o -> IO AuthNegotiate) -> o -> m AuthNegotiate
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr AuthNegotiate -> AuthNegotiate)
-> o -> IO AuthNegotiate
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
 ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr AuthNegotiate -> AuthNegotiate
AuthNegotiate

#if defined(ENABLE_OVERLOADING)
type family ResolveAuthNegotiateMethod (t :: Symbol) (o :: *) :: * where
    ResolveAuthNegotiateMethod "authenticate" o = Soup.Auth.AuthAuthenticateMethodInfo
    ResolveAuthNegotiateMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveAuthNegotiateMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveAuthNegotiateMethod "canAuthenticate" o = Soup.Auth.AuthCanAuthenticateMethodInfo
    ResolveAuthNegotiateMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveAuthNegotiateMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveAuthNegotiateMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveAuthNegotiateMethod "hasSavedPassword" o = Soup.Auth.AuthHasSavedPasswordMethodInfo
    ResolveAuthNegotiateMethod "isAuthenticated" o = Soup.Auth.AuthIsAuthenticatedMethodInfo
    ResolveAuthNegotiateMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveAuthNegotiateMethod "isForProxy" o = Soup.Auth.AuthIsForProxyMethodInfo
    ResolveAuthNegotiateMethod "isReady" o = Soup.Auth.AuthIsReadyMethodInfo
    ResolveAuthNegotiateMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveAuthNegotiateMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveAuthNegotiateMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveAuthNegotiateMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveAuthNegotiateMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveAuthNegotiateMethod "savePassword" o = Soup.Auth.AuthSavePasswordMethodInfo
    ResolveAuthNegotiateMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveAuthNegotiateMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveAuthNegotiateMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveAuthNegotiateMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveAuthNegotiateMethod "update" o = Soup.Auth.AuthUpdateMethodInfo
    ResolveAuthNegotiateMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveAuthNegotiateMethod "getAuthorization" o = Soup.Auth.AuthGetAuthorizationMethodInfo
    ResolveAuthNegotiateMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveAuthNegotiateMethod "getHost" o = Soup.Auth.AuthGetHostMethodInfo
    ResolveAuthNegotiateMethod "getInfo" o = Soup.Auth.AuthGetInfoMethodInfo
    ResolveAuthNegotiateMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveAuthNegotiateMethod "getProtectionSpace" o = Soup.Auth.AuthGetProtectionSpaceMethodInfo
    ResolveAuthNegotiateMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveAuthNegotiateMethod "getRealm" o = Soup.Auth.AuthGetRealmMethodInfo
    ResolveAuthNegotiateMethod "getSavedPassword" o = Soup.Auth.AuthGetSavedPasswordMethodInfo
    ResolveAuthNegotiateMethod "getSavedUsers" o = Soup.Auth.AuthGetSavedUsersMethodInfo
    ResolveAuthNegotiateMethod "getSchemeName" o = Soup.Auth.AuthGetSchemeNameMethodInfo
    ResolveAuthNegotiateMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveAuthNegotiateMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveAuthNegotiateMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveAuthNegotiateMethod l o = O.MethodResolutionFailed l o

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

#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList AuthNegotiate
type instance O.AttributeList AuthNegotiate = AuthNegotiateAttributeList
type AuthNegotiateAttributeList = ('[ '("host", Soup.Auth.AuthHostPropertyInfo), '("isAuthenticated", Soup.Auth.AuthIsAuthenticatedPropertyInfo), '("isForProxy", Soup.Auth.AuthIsForProxyPropertyInfo), '("realm", Soup.Auth.AuthRealmPropertyInfo), '("schemeName", Soup.Auth.AuthSchemeNamePropertyInfo)] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
#endif

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

#endif

-- method AuthNegotiate::supported
-- method type : MemberFunction
-- Args: []
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "soup_auth_negotiate_supported" soup_auth_negotiate_supported :: 
    IO CInt

-- | Indicates whether libsoup was built with GSSAPI support. If this is
-- 'P.False', @/SOUP_TYPE_AUTH_NEGOTIATE/@ will still be defined and can
-- still be added to a t'GI.Soup.Objects.Session.Session', but libsoup will never attempt to
-- actually use this auth type.
-- 
-- /Since: 2.54/
authNegotiateSupported ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Bool
authNegotiateSupported :: m Bool
authNegotiateSupported  = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    CInt
result <- IO CInt
soup_auth_negotiate_supported
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if defined(ENABLE_OVERLOADING)
#endif