{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
-}

module GI.Gio.Interfaces.TlsBackend
    ( 

-- * Exported types
    TlsBackend(..)                          ,
    noTlsBackend                            ,
    TlsBackendK                             ,
    toTlsBackend                            ,


 -- * Methods
-- ** tlsBackendGetCertificateType
    tlsBackendGetCertificateType            ,


-- ** tlsBackendGetClientConnectionType
    tlsBackendGetClientConnectionType       ,


-- ** tlsBackendGetDefaultDatabase
    tlsBackendGetDefaultDatabase            ,


-- ** tlsBackendGetFileDatabaseType
    tlsBackendGetFileDatabaseType           ,


-- ** tlsBackendGetServerConnectionType
    tlsBackendGetServerConnectionType       ,


-- ** tlsBackendSupportsTls
    tlsBackendSupportsTls                   ,




    ) where

import Prelude ()
import Data.GI.Base.ShortPrelude

import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map

import GI.Gio.Types
import GI.Gio.Callbacks
import qualified GI.GObject as GObject

-- interface TlsBackend 

newtype TlsBackend = TlsBackend (ForeignPtr TlsBackend)
noTlsBackend :: Maybe TlsBackend
noTlsBackend = Nothing

type instance AttributeList TlsBackend = TlsBackendAttributeList
type TlsBackendAttributeList = ('[ ] :: [(Symbol, *)])

type instance SignalList TlsBackend = TlsBackendSignalList
type TlsBackendSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

foreign import ccall "g_tls_backend_get_type"
    c_g_tls_backend_get_type :: IO GType

type instance ParentTypes TlsBackend = TlsBackendParentTypes
type TlsBackendParentTypes = '[GObject.Object]

instance GObject TlsBackend where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_g_tls_backend_get_type
    

class GObject o => TlsBackendK o
instance (GObject o, IsDescendantOf TlsBackend o) => TlsBackendK o

toTlsBackend :: TlsBackendK o => o -> IO TlsBackend
toTlsBackend = unsafeCastTo TlsBackend

-- method TlsBackend::get_certificate_type
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "TlsBackend", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "TlsBackend", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TGType
-- throws : False
-- Skip return : False

foreign import ccall "g_tls_backend_get_certificate_type" g_tls_backend_get_certificate_type :: 
    Ptr TlsBackend ->                       -- _obj : TInterface "Gio" "TlsBackend"
    IO CGType


tlsBackendGetCertificateType ::
    (MonadIO m, TlsBackendK a) =>
    a ->                                    -- _obj
    m GType
tlsBackendGetCertificateType _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_tls_backend_get_certificate_type _obj'
    let result' = GType result
    touchManagedPtr _obj
    return result'

-- method TlsBackend::get_client_connection_type
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "TlsBackend", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "TlsBackend", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TGType
-- throws : False
-- Skip return : False

foreign import ccall "g_tls_backend_get_client_connection_type" g_tls_backend_get_client_connection_type :: 
    Ptr TlsBackend ->                       -- _obj : TInterface "Gio" "TlsBackend"
    IO CGType


tlsBackendGetClientConnectionType ::
    (MonadIO m, TlsBackendK a) =>
    a ->                                    -- _obj
    m GType
tlsBackendGetClientConnectionType _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_tls_backend_get_client_connection_type _obj'
    let result' = GType result
    touchManagedPtr _obj
    return result'

-- method TlsBackend::get_default_database
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "TlsBackend", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "TlsBackend", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "TlsDatabase"
-- throws : False
-- Skip return : False

foreign import ccall "g_tls_backend_get_default_database" g_tls_backend_get_default_database :: 
    Ptr TlsBackend ->                       -- _obj : TInterface "Gio" "TlsBackend"
    IO (Ptr TlsDatabase)


tlsBackendGetDefaultDatabase ::
    (MonadIO m, TlsBackendK a) =>
    a ->                                    -- _obj
    m TlsDatabase
tlsBackendGetDefaultDatabase _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_tls_backend_get_default_database _obj'
    checkUnexpectedReturnNULL "g_tls_backend_get_default_database" result
    result' <- (wrapObject TlsDatabase) result
    touchManagedPtr _obj
    return result'

-- method TlsBackend::get_file_database_type
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "TlsBackend", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "TlsBackend", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TGType
-- throws : False
-- Skip return : False

foreign import ccall "g_tls_backend_get_file_database_type" g_tls_backend_get_file_database_type :: 
    Ptr TlsBackend ->                       -- _obj : TInterface "Gio" "TlsBackend"
    IO CGType


tlsBackendGetFileDatabaseType ::
    (MonadIO m, TlsBackendK a) =>
    a ->                                    -- _obj
    m GType
tlsBackendGetFileDatabaseType _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_tls_backend_get_file_database_type _obj'
    let result' = GType result
    touchManagedPtr _obj
    return result'

-- method TlsBackend::get_server_connection_type
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "TlsBackend", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "TlsBackend", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TGType
-- throws : False
-- Skip return : False

foreign import ccall "g_tls_backend_get_server_connection_type" g_tls_backend_get_server_connection_type :: 
    Ptr TlsBackend ->                       -- _obj : TInterface "Gio" "TlsBackend"
    IO CGType


tlsBackendGetServerConnectionType ::
    (MonadIO m, TlsBackendK a) =>
    a ->                                    -- _obj
    m GType
tlsBackendGetServerConnectionType _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_tls_backend_get_server_connection_type _obj'
    let result' = GType result
    touchManagedPtr _obj
    return result'

-- method TlsBackend::supports_tls
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "TlsBackend", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "TlsBackend", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "g_tls_backend_supports_tls" g_tls_backend_supports_tls :: 
    Ptr TlsBackend ->                       -- _obj : TInterface "Gio" "TlsBackend"
    IO CInt


tlsBackendSupportsTls ::
    (MonadIO m, TlsBackendK a) =>
    a ->                                    -- _obj
    m Bool
tlsBackendSupportsTls _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_tls_backend_supports_tls _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'