{- |
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.SimpleProxyResolver
    ( 

-- * Exported types
    SimpleProxyResolver(..)                 ,
    SimpleProxyResolverK                    ,
    toSimpleProxyResolver                   ,
    noSimpleProxyResolver                   ,


 -- * Methods
-- ** simpleProxyResolverNew
    simpleProxyResolverNew                  ,


-- ** simpleProxyResolverSetDefaultProxy
    simpleProxyResolverSetDefaultProxy      ,


-- ** simpleProxyResolverSetIgnoreHosts
    simpleProxyResolverSetIgnoreHosts       ,


-- ** simpleProxyResolverSetUriProxy
    simpleProxyResolverSetUriProxy          ,




 -- * Properties
-- ** DefaultProxy
    SimpleProxyResolverDefaultProxyPropertyInfo,
    constructSimpleProxyResolverDefaultProxy,
    getSimpleProxyResolverDefaultProxy      ,
    setSimpleProxyResolverDefaultProxy      ,


-- ** IgnoreHosts
    SimpleProxyResolverIgnoreHostsPropertyInfo,
    constructSimpleProxyResolverIgnoreHosts ,
    getSimpleProxyResolverIgnoreHosts       ,
    setSimpleProxyResolverIgnoreHosts       ,




    ) 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 SimpleProxyResolver = SimpleProxyResolver (ForeignPtr SimpleProxyResolver)
foreign import ccall "g_simple_proxy_resolver_get_type"
    c_g_simple_proxy_resolver_get_type :: IO GType

type instance ParentTypes SimpleProxyResolver = SimpleProxyResolverParentTypes
type SimpleProxyResolverParentTypes = '[GObject.Object, ProxyResolver]

instance GObject SimpleProxyResolver where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_g_simple_proxy_resolver_get_type
    

class GObject o => SimpleProxyResolverK o
instance (GObject o, IsDescendantOf SimpleProxyResolver o) => SimpleProxyResolverK o

toSimpleProxyResolver :: SimpleProxyResolverK o => o -> IO SimpleProxyResolver
toSimpleProxyResolver = unsafeCastTo SimpleProxyResolver

noSimpleProxyResolver :: Maybe SimpleProxyResolver
noSimpleProxyResolver = Nothing

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

getSimpleProxyResolverDefaultProxy :: (MonadIO m, SimpleProxyResolverK o) => o -> m T.Text
getSimpleProxyResolverDefaultProxy obj = liftIO $ getObjectPropertyString obj "default-proxy"

setSimpleProxyResolverDefaultProxy :: (MonadIO m, SimpleProxyResolverK o) => o -> T.Text -> m ()
setSimpleProxyResolverDefaultProxy obj val = liftIO $ setObjectPropertyString obj "default-proxy" val

constructSimpleProxyResolverDefaultProxy :: T.Text -> IO ([Char], GValue)
constructSimpleProxyResolverDefaultProxy val = constructObjectPropertyString "default-proxy" val

data SimpleProxyResolverDefaultProxyPropertyInfo
instance AttrInfo SimpleProxyResolverDefaultProxyPropertyInfo where
    type AttrAllowedOps SimpleProxyResolverDefaultProxyPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint SimpleProxyResolverDefaultProxyPropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint SimpleProxyResolverDefaultProxyPropertyInfo = SimpleProxyResolverK
    type AttrGetType SimpleProxyResolverDefaultProxyPropertyInfo = T.Text
    type AttrLabel SimpleProxyResolverDefaultProxyPropertyInfo = "SimpleProxyResolver::default-proxy"
    attrGet _ = getSimpleProxyResolverDefaultProxy
    attrSet _ = setSimpleProxyResolverDefaultProxy
    attrConstruct _ = constructSimpleProxyResolverDefaultProxy

-- VVV Prop "ignore-hosts"
   -- Type: TCArray True (-1) (-1) (TBasicType TUTF8)
   -- Flags: [PropertyReadable,PropertyWritable]

getSimpleProxyResolverIgnoreHosts :: (MonadIO m, SimpleProxyResolverK o) => o -> m [T.Text]
getSimpleProxyResolverIgnoreHosts obj = liftIO $ getObjectPropertyStringArray obj "ignore-hosts"

setSimpleProxyResolverIgnoreHosts :: (MonadIO m, SimpleProxyResolverK o) => o -> [T.Text] -> m ()
setSimpleProxyResolverIgnoreHosts obj val = liftIO $ setObjectPropertyStringArray obj "ignore-hosts" val

constructSimpleProxyResolverIgnoreHosts :: [T.Text] -> IO ([Char], GValue)
constructSimpleProxyResolverIgnoreHosts val = constructObjectPropertyStringArray "ignore-hosts" val

data SimpleProxyResolverIgnoreHostsPropertyInfo
instance AttrInfo SimpleProxyResolverIgnoreHostsPropertyInfo where
    type AttrAllowedOps SimpleProxyResolverIgnoreHostsPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint SimpleProxyResolverIgnoreHostsPropertyInfo = (~) [T.Text]
    type AttrBaseTypeConstraint SimpleProxyResolverIgnoreHostsPropertyInfo = SimpleProxyResolverK
    type AttrGetType SimpleProxyResolverIgnoreHostsPropertyInfo = [T.Text]
    type AttrLabel SimpleProxyResolverIgnoreHostsPropertyInfo = "SimpleProxyResolver::ignore-hosts"
    attrGet _ = getSimpleProxyResolverIgnoreHosts
    attrSet _ = setSimpleProxyResolverIgnoreHosts
    attrConstruct _ = constructSimpleProxyResolverIgnoreHosts

type instance AttributeList SimpleProxyResolver = SimpleProxyResolverAttributeList
type SimpleProxyResolverAttributeList = ('[ '("default-proxy", SimpleProxyResolverDefaultProxyPropertyInfo), '("ignore-hosts", SimpleProxyResolverIgnoreHostsPropertyInfo)] :: [(Symbol, *)])

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

-- method SimpleProxyResolver::set_default_proxy
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "SimpleProxyResolver", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "default_proxy", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "SimpleProxyResolver", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "default_proxy", 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_simple_proxy_resolver_set_default_proxy" g_simple_proxy_resolver_set_default_proxy :: 
    Ptr SimpleProxyResolver ->              -- _obj : TInterface "Gio" "SimpleProxyResolver"
    CString ->                              -- default_proxy : TBasicType TUTF8
    IO ()


simpleProxyResolverSetDefaultProxy ::
    (MonadIO m, SimpleProxyResolverK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- default_proxy
    m ()
simpleProxyResolverSetDefaultProxy _obj default_proxy = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    default_proxy' <- textToCString default_proxy
    g_simple_proxy_resolver_set_default_proxy _obj' default_proxy'
    touchManagedPtr _obj
    freeMem default_proxy'
    return ()

-- method SimpleProxyResolver::set_ignore_hosts
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "SimpleProxyResolver", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "ignore_hosts", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "SimpleProxyResolver", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "ignore_hosts", 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_simple_proxy_resolver_set_ignore_hosts" g_simple_proxy_resolver_set_ignore_hosts :: 
    Ptr SimpleProxyResolver ->              -- _obj : TInterface "Gio" "SimpleProxyResolver"
    CString ->                              -- ignore_hosts : TBasicType TUTF8
    IO ()


simpleProxyResolverSetIgnoreHosts ::
    (MonadIO m, SimpleProxyResolverK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- ignore_hosts
    m ()
simpleProxyResolverSetIgnoreHosts _obj ignore_hosts = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    ignore_hosts' <- textToCString ignore_hosts
    g_simple_proxy_resolver_set_ignore_hosts _obj' ignore_hosts'
    touchManagedPtr _obj
    freeMem ignore_hosts'
    return ()

-- method SimpleProxyResolver::set_uri_proxy
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "SimpleProxyResolver", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "uri_scheme", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "proxy", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "SimpleProxyResolver", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "uri_scheme", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "proxy", 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_simple_proxy_resolver_set_uri_proxy" g_simple_proxy_resolver_set_uri_proxy :: 
    Ptr SimpleProxyResolver ->              -- _obj : TInterface "Gio" "SimpleProxyResolver"
    CString ->                              -- uri_scheme : TBasicType TUTF8
    CString ->                              -- proxy : TBasicType TUTF8
    IO ()


simpleProxyResolverSetUriProxy ::
    (MonadIO m, SimpleProxyResolverK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- uri_scheme
    T.Text ->                               -- proxy
    m ()
simpleProxyResolverSetUriProxy _obj uri_scheme proxy = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    uri_scheme' <- textToCString uri_scheme
    proxy' <- textToCString proxy
    g_simple_proxy_resolver_set_uri_proxy _obj' uri_scheme' proxy'
    touchManagedPtr _obj
    freeMem uri_scheme'
    freeMem proxy'
    return ()

-- method SimpleProxyResolver::new
-- method type : MemberFunction
-- Args : [Arg {argName = "default_proxy", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "ignore_hosts", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "default_proxy", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "ignore_hosts", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "ProxyResolver"
-- throws : False
-- Skip return : False

foreign import ccall "g_simple_proxy_resolver_new" g_simple_proxy_resolver_new :: 
    CString ->                              -- default_proxy : TBasicType TUTF8
    CString ->                              -- ignore_hosts : TBasicType TUTF8
    IO (Ptr ProxyResolver)


simpleProxyResolverNew ::
    (MonadIO m) =>
    Maybe (T.Text) ->                       -- default_proxy
    Maybe (T.Text) ->                       -- ignore_hosts
    m ProxyResolver
simpleProxyResolverNew default_proxy ignore_hosts = liftIO $ do
    maybeDefault_proxy <- case default_proxy of
        Nothing -> return nullPtr
        Just jDefault_proxy -> do
            jDefault_proxy' <- textToCString jDefault_proxy
            return jDefault_proxy'
    maybeIgnore_hosts <- case ignore_hosts of
        Nothing -> return nullPtr
        Just jIgnore_hosts -> do
            jIgnore_hosts' <- textToCString jIgnore_hosts
            return jIgnore_hosts'
    result <- g_simple_proxy_resolver_new maybeDefault_proxy maybeIgnore_hosts
    checkUnexpectedReturnNULL "g_simple_proxy_resolver_new" result
    result' <- (wrapObject ProxyResolver) result
    freeMem maybeDefault_proxy
    freeMem maybeIgnore_hosts
    return result'