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

Represents a git proxy options.
-}

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

module GI.Ggit.Objects.ProxyOptions
    (

-- * Exported types
    ProxyOptions(..)                        ,
    IsProxyOptions                          ,
    toProxyOptions                          ,
    noProxyOptions                          ,


 -- * Methods
-- ** new #method:new#

    proxyOptionsNew                         ,




    ) 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.GObject.Objects.Object as GObject.Object

-- | Memory-managed wrapper type.
newtype ProxyOptions = ProxyOptions (ManagedPtr ProxyOptions)
foreign import ccall "ggit_proxy_options_get_type"
    c_ggit_proxy_options_get_type :: IO GType

instance GObject ProxyOptions where
    gobjectType = c_ggit_proxy_options_get_type


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

instance O.HasParentTypes ProxyOptions
type instance O.ParentTypes ProxyOptions = '[GObject.Object.Object]

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

-- | A convenience alias for `Nothing` :: `Maybe` `ProxyOptions`.
noProxyOptions :: Maybe ProxyOptions
noProxyOptions = Nothing

#if ENABLE_OVERLOADING
type family ResolveProxyOptionsMethod (t :: Symbol) (o :: *) :: * where
    ResolveProxyOptionsMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveProxyOptionsMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveProxyOptionsMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveProxyOptionsMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveProxyOptionsMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveProxyOptionsMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveProxyOptionsMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveProxyOptionsMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveProxyOptionsMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveProxyOptionsMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveProxyOptionsMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveProxyOptionsMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveProxyOptionsMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveProxyOptionsMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveProxyOptionsMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveProxyOptionsMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveProxyOptionsMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveProxyOptionsMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveProxyOptionsMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveProxyOptionsMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveProxyOptionsMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveProxyOptionsMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveProxyOptionsMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveProxyOptionsMethod t ProxyOptions, O.MethodInfo info ProxyOptions p) => OL.IsLabel t (ProxyOptions -> 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

#if ENABLE_OVERLOADING
instance O.HasAttributeList ProxyOptions
type instance O.AttributeList ProxyOptions = ProxyOptionsAttributeList
type ProxyOptionsAttributeList = ('[ ] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
#endif

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

#endif

-- method ProxyOptions::new
-- method type : Constructor
-- Args : []
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Ggit", name = "ProxyOptions"}))
-- throws : False
-- Skip return : False

foreign import ccall "ggit_proxy_options_new" ggit_proxy_options_new ::
    IO (Ptr ProxyOptions)

{- |
Create a new proxy options object.
-}
proxyOptionsNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m (Maybe ProxyOptions)
    {- ^ __Returns:__ a 'GI.Ggit.Objects.ProxyOptions.ProxyOptions'. -}
proxyOptionsNew  = liftIO $ do
    result <- ggit_proxy_options_new
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (wrapObject ProxyOptions) result'
        return result''
    return maybeResult

#if ENABLE_OVERLOADING
#endif