{- |
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.Objects.NetworkService
    ( 

-- * Exported types
    NetworkService(..)                      ,
    NetworkServiceK                         ,
    toNetworkService                        ,
    noNetworkService                        ,


 -- * Methods
-- ** networkServiceGetDomain
    networkServiceGetDomain                 ,


-- ** networkServiceGetProtocol
    networkServiceGetProtocol               ,


-- ** networkServiceGetScheme
    networkServiceGetScheme                 ,


-- ** networkServiceGetService
    networkServiceGetService                ,


-- ** networkServiceNew
    networkServiceNew                       ,


-- ** networkServiceSetScheme
    networkServiceSetScheme                 ,




 -- * Properties
-- ** Domain
    NetworkServiceDomainPropertyInfo        ,
    constructNetworkServiceDomain           ,
    getNetworkServiceDomain                 ,


-- ** Protocol
    NetworkServiceProtocolPropertyInfo      ,
    constructNetworkServiceProtocol         ,
    getNetworkServiceProtocol               ,


-- ** Scheme
    NetworkServiceSchemePropertyInfo        ,
    constructNetworkServiceScheme           ,
    getNetworkServiceScheme                 ,
    setNetworkServiceScheme                 ,


-- ** Service
    NetworkServiceServicePropertyInfo       ,
    constructNetworkServiceService          ,
    getNetworkServiceService                ,




    ) 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

newtype NetworkService = NetworkService (ForeignPtr NetworkService)
foreign import ccall "g_network_service_get_type"
    c_g_network_service_get_type :: IO GType

type instance ParentTypes NetworkService = NetworkServiceParentTypes
type NetworkServiceParentTypes = '[GObject.Object, SocketConnectable]

instance GObject NetworkService where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_g_network_service_get_type
    

class GObject o => NetworkServiceK o
instance (GObject o, IsDescendantOf NetworkService o) => NetworkServiceK o

toNetworkService :: NetworkServiceK o => o -> IO NetworkService
toNetworkService = unsafeCastTo NetworkService

noNetworkService :: Maybe NetworkService
noNetworkService = Nothing

-- VVV Prop "domain"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]

getNetworkServiceDomain :: (MonadIO m, NetworkServiceK o) => o -> m T.Text
getNetworkServiceDomain obj = liftIO $ getObjectPropertyString obj "domain"

constructNetworkServiceDomain :: T.Text -> IO ([Char], GValue)
constructNetworkServiceDomain val = constructObjectPropertyString "domain" val

data NetworkServiceDomainPropertyInfo
instance AttrInfo NetworkServiceDomainPropertyInfo where
    type AttrAllowedOps NetworkServiceDomainPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint NetworkServiceDomainPropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint NetworkServiceDomainPropertyInfo = NetworkServiceK
    type AttrGetType NetworkServiceDomainPropertyInfo = T.Text
    type AttrLabel NetworkServiceDomainPropertyInfo = "NetworkService::domain"
    attrGet _ = getNetworkServiceDomain
    attrSet _ = undefined
    attrConstruct _ = constructNetworkServiceDomain

-- VVV Prop "protocol"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]

getNetworkServiceProtocol :: (MonadIO m, NetworkServiceK o) => o -> m T.Text
getNetworkServiceProtocol obj = liftIO $ getObjectPropertyString obj "protocol"

constructNetworkServiceProtocol :: T.Text -> IO ([Char], GValue)
constructNetworkServiceProtocol val = constructObjectPropertyString "protocol" val

data NetworkServiceProtocolPropertyInfo
instance AttrInfo NetworkServiceProtocolPropertyInfo where
    type AttrAllowedOps NetworkServiceProtocolPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint NetworkServiceProtocolPropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint NetworkServiceProtocolPropertyInfo = NetworkServiceK
    type AttrGetType NetworkServiceProtocolPropertyInfo = T.Text
    type AttrLabel NetworkServiceProtocolPropertyInfo = "NetworkService::protocol"
    attrGet _ = getNetworkServiceProtocol
    attrSet _ = undefined
    attrConstruct _ = constructNetworkServiceProtocol

-- VVV Prop "scheme"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable]

getNetworkServiceScheme :: (MonadIO m, NetworkServiceK o) => o -> m T.Text
getNetworkServiceScheme obj = liftIO $ getObjectPropertyString obj "scheme"

setNetworkServiceScheme :: (MonadIO m, NetworkServiceK o) => o -> T.Text -> m ()
setNetworkServiceScheme obj val = liftIO $ setObjectPropertyString obj "scheme" val

constructNetworkServiceScheme :: T.Text -> IO ([Char], GValue)
constructNetworkServiceScheme val = constructObjectPropertyString "scheme" val

data NetworkServiceSchemePropertyInfo
instance AttrInfo NetworkServiceSchemePropertyInfo where
    type AttrAllowedOps NetworkServiceSchemePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint NetworkServiceSchemePropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint NetworkServiceSchemePropertyInfo = NetworkServiceK
    type AttrGetType NetworkServiceSchemePropertyInfo = T.Text
    type AttrLabel NetworkServiceSchemePropertyInfo = "NetworkService::scheme"
    attrGet _ = getNetworkServiceScheme
    attrSet _ = setNetworkServiceScheme
    attrConstruct _ = constructNetworkServiceScheme

-- VVV Prop "service"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]

getNetworkServiceService :: (MonadIO m, NetworkServiceK o) => o -> m T.Text
getNetworkServiceService obj = liftIO $ getObjectPropertyString obj "service"

constructNetworkServiceService :: T.Text -> IO ([Char], GValue)
constructNetworkServiceService val = constructObjectPropertyString "service" val

data NetworkServiceServicePropertyInfo
instance AttrInfo NetworkServiceServicePropertyInfo where
    type AttrAllowedOps NetworkServiceServicePropertyInfo = '[ 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint NetworkServiceServicePropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint NetworkServiceServicePropertyInfo = NetworkServiceK
    type AttrGetType NetworkServiceServicePropertyInfo = T.Text
    type AttrLabel NetworkServiceServicePropertyInfo = "NetworkService::service"
    attrGet _ = getNetworkServiceService
    attrSet _ = undefined
    attrConstruct _ = constructNetworkServiceService

type instance AttributeList NetworkService = NetworkServiceAttributeList
type NetworkServiceAttributeList = ('[ '("domain", NetworkServiceDomainPropertyInfo), '("protocol", NetworkServiceProtocolPropertyInfo), '("scheme", NetworkServiceSchemePropertyInfo), '("service", NetworkServiceServicePropertyInfo)] :: [(Symbol, *)])

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

-- method NetworkService::new
-- method type : Constructor
-- Args : [Arg {argName = "service", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "protocol", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "domain", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "service", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "protocol", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "domain", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "NetworkService"
-- throws : False
-- Skip return : False

foreign import ccall "g_network_service_new" g_network_service_new :: 
    CString ->                              -- service : TBasicType TUTF8
    CString ->                              -- protocol : TBasicType TUTF8
    CString ->                              -- domain : TBasicType TUTF8
    IO (Ptr NetworkService)


networkServiceNew ::
    (MonadIO m) =>
    T.Text ->                               -- service
    T.Text ->                               -- protocol
    T.Text ->                               -- domain
    m NetworkService
networkServiceNew service protocol domain = liftIO $ do
    service' <- textToCString service
    protocol' <- textToCString protocol
    domain' <- textToCString domain
    result <- g_network_service_new service' protocol' domain'
    checkUnexpectedReturnNULL "g_network_service_new" result
    result' <- (wrapObject NetworkService) result
    freeMem service'
    freeMem protocol'
    freeMem domain'
    return result'

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

foreign import ccall "g_network_service_get_domain" g_network_service_get_domain :: 
    Ptr NetworkService ->                   -- _obj : TInterface "Gio" "NetworkService"
    IO CString


networkServiceGetDomain ::
    (MonadIO m, NetworkServiceK a) =>
    a ->                                    -- _obj
    m T.Text
networkServiceGetDomain _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_network_service_get_domain _obj'
    checkUnexpectedReturnNULL "g_network_service_get_domain" result
    result' <- cstringToText result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "g_network_service_get_protocol" g_network_service_get_protocol :: 
    Ptr NetworkService ->                   -- _obj : TInterface "Gio" "NetworkService"
    IO CString


networkServiceGetProtocol ::
    (MonadIO m, NetworkServiceK a) =>
    a ->                                    -- _obj
    m T.Text
networkServiceGetProtocol _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_network_service_get_protocol _obj'
    checkUnexpectedReturnNULL "g_network_service_get_protocol" result
    result' <- cstringToText result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "g_network_service_get_scheme" g_network_service_get_scheme :: 
    Ptr NetworkService ->                   -- _obj : TInterface "Gio" "NetworkService"
    IO CString


networkServiceGetScheme ::
    (MonadIO m, NetworkServiceK a) =>
    a ->                                    -- _obj
    m T.Text
networkServiceGetScheme _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_network_service_get_scheme _obj'
    checkUnexpectedReturnNULL "g_network_service_get_scheme" result
    result' <- cstringToText result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "g_network_service_get_service" g_network_service_get_service :: 
    Ptr NetworkService ->                   -- _obj : TInterface "Gio" "NetworkService"
    IO CString


networkServiceGetService ::
    (MonadIO m, NetworkServiceK a) =>
    a ->                                    -- _obj
    m T.Text
networkServiceGetService _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_network_service_get_service _obj'
    checkUnexpectedReturnNULL "g_network_service_get_service" result
    result' <- cstringToText result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "g_network_service_set_scheme" g_network_service_set_scheme :: 
    Ptr NetworkService ->                   -- _obj : TInterface "Gio" "NetworkService"
    CString ->                              -- scheme : TBasicType TUTF8
    IO ()


networkServiceSetScheme ::
    (MonadIO m, NetworkServiceK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- scheme
    m ()
networkServiceSetScheme _obj scheme = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    scheme' <- textToCString scheme
    g_network_service_set_scheme _obj' scheme'
    touchManagedPtr _obj
    freeMem scheme'
    return ()