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

-- * Exported types
    DOMGamepad(..)                          ,
    IsDOMGamepad                            ,
    toDOMGamepad                            ,
    noDOMGamepad                            ,


 -- * Methods
-- ** getId #method:getId#
    DOMGamepadGetIdMethodInfo               ,
    dOMGamepadGetId                         ,


-- ** getIndex #method:getIndex#
    DOMGamepadGetIndexMethodInfo            ,
    dOMGamepadGetIndex                      ,


-- ** getTimestamp #method:getTimestamp#
    DOMGamepadGetTimestampMethodInfo        ,
    dOMGamepadGetTimestamp                  ,




 -- * Properties
-- ** id #attr:id#
    DOMGamepadIdPropertyInfo                ,
    dOMGamepadId                            ,
    getDOMGamepadId                         ,


-- ** index #attr:index#
    DOMGamepadIndexPropertyInfo             ,
    dOMGamepadIndex                         ,
    getDOMGamepadIndex                      ,


-- ** timestamp #attr:timestamp#
    DOMGamepadTimestampPropertyInfo         ,
    dOMGamepadTimestamp                     ,
    getDOMGamepadTimestamp                  ,




    ) 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.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
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 GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.WebKit.Objects.DOMObject as WebKit.DOMObject

newtype DOMGamepad = DOMGamepad (ManagedPtr DOMGamepad)
foreign import ccall "webkit_dom_gamepad_get_type"
    c_webkit_dom_gamepad_get_type :: IO GType

instance GObject DOMGamepad where
    gobjectType _ = c_webkit_dom_gamepad_get_type
    

class GObject o => IsDOMGamepad o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError DOMGamepad a) =>
    IsDOMGamepad a
#endif
instance IsDOMGamepad DOMGamepad
instance WebKit.DOMObject.IsDOMObject DOMGamepad
instance GObject.Object.IsObject DOMGamepad

toDOMGamepad :: IsDOMGamepad o => o -> IO DOMGamepad
toDOMGamepad = unsafeCastTo DOMGamepad

noDOMGamepad :: Maybe DOMGamepad
noDOMGamepad = Nothing

type family ResolveDOMGamepadMethod (t :: Symbol) (o :: *) :: * where
    ResolveDOMGamepadMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveDOMGamepadMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveDOMGamepadMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveDOMGamepadMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveDOMGamepadMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveDOMGamepadMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveDOMGamepadMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveDOMGamepadMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveDOMGamepadMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveDOMGamepadMethod "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
    ResolveDOMGamepadMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
    ResolveDOMGamepadMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveDOMGamepadMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveDOMGamepadMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveDOMGamepadMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveDOMGamepadMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveDOMGamepadMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveDOMGamepadMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveDOMGamepadMethod "getId" o = DOMGamepadGetIdMethodInfo
    ResolveDOMGamepadMethod "getIndex" o = DOMGamepadGetIndexMethodInfo
    ResolveDOMGamepadMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveDOMGamepadMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveDOMGamepadMethod "getTimestamp" o = DOMGamepadGetTimestampMethodInfo
    ResolveDOMGamepadMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveDOMGamepadMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveDOMGamepadMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveDOMGamepadMethod t DOMGamepad, O.MethodInfo info DOMGamepad p) => O.IsLabelProxy t (DOMGamepad -> p) where
    fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveDOMGamepadMethod t DOMGamepad, O.MethodInfo info DOMGamepad p) => O.IsLabel t (DOMGamepad -> p) where
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

-- VVV Prop "id"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

getDOMGamepadId :: (MonadIO m, IsDOMGamepad o) => o -> m (Maybe T.Text)
getDOMGamepadId obj = liftIO $ getObjectPropertyString obj "id"

data DOMGamepadIdPropertyInfo
instance AttrInfo DOMGamepadIdPropertyInfo where
    type AttrAllowedOps DOMGamepadIdPropertyInfo = '[ 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint DOMGamepadIdPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMGamepadIdPropertyInfo = IsDOMGamepad
    type AttrGetType DOMGamepadIdPropertyInfo = (Maybe T.Text)
    type AttrLabel DOMGamepadIdPropertyInfo = "id"
    type AttrOrigin DOMGamepadIdPropertyInfo = DOMGamepad
    attrGet _ = getDOMGamepadId
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

-- VVV Prop "index"
   -- Type: TBasicType TULong
   -- Flags: [PropertyReadable]
   -- Nullable: (Just False,Nothing)

getDOMGamepadIndex :: (MonadIO m, IsDOMGamepad o) => o -> m CULong
getDOMGamepadIndex obj = liftIO $ getObjectPropertyULong obj "index"

data DOMGamepadIndexPropertyInfo
instance AttrInfo DOMGamepadIndexPropertyInfo where
    type AttrAllowedOps DOMGamepadIndexPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DOMGamepadIndexPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMGamepadIndexPropertyInfo = IsDOMGamepad
    type AttrGetType DOMGamepadIndexPropertyInfo = CULong
    type AttrLabel DOMGamepadIndexPropertyInfo = "index"
    type AttrOrigin DOMGamepadIndexPropertyInfo = DOMGamepad
    attrGet _ = getDOMGamepadIndex
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

-- VVV Prop "timestamp"
   -- Type: TBasicType TUInt64
   -- Flags: [PropertyReadable]
   -- Nullable: (Just False,Nothing)

getDOMGamepadTimestamp :: (MonadIO m, IsDOMGamepad o) => o -> m Word64
getDOMGamepadTimestamp obj = liftIO $ getObjectPropertyUInt64 obj "timestamp"

data DOMGamepadTimestampPropertyInfo
instance AttrInfo DOMGamepadTimestampPropertyInfo where
    type AttrAllowedOps DOMGamepadTimestampPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DOMGamepadTimestampPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMGamepadTimestampPropertyInfo = IsDOMGamepad
    type AttrGetType DOMGamepadTimestampPropertyInfo = Word64
    type AttrLabel DOMGamepadTimestampPropertyInfo = "timestamp"
    type AttrOrigin DOMGamepadTimestampPropertyInfo = DOMGamepad
    attrGet _ = getDOMGamepadTimestamp
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

instance O.HasAttributeList DOMGamepad
type instance O.AttributeList DOMGamepad = DOMGamepadAttributeList
type DOMGamepadAttributeList = ('[ '("coreObject", WebKit.DOMObject.DOMObjectCoreObjectPropertyInfo), '("id", DOMGamepadIdPropertyInfo), '("index", DOMGamepadIndexPropertyInfo), '("timestamp", DOMGamepadTimestampPropertyInfo)] :: [(Symbol, *)])

dOMGamepadId :: AttrLabelProxy "id"
dOMGamepadId = AttrLabelProxy

dOMGamepadIndex :: AttrLabelProxy "index"
dOMGamepadIndex = AttrLabelProxy

dOMGamepadTimestamp :: AttrLabelProxy "timestamp"
dOMGamepadTimestamp = AttrLabelProxy

type instance O.SignalList DOMGamepad = DOMGamepadSignalList
type DOMGamepadSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method DOMGamepad::get_id
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "WebKit", name = "DOMGamepad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #WebKitDOMGamepad", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "webkit_dom_gamepad_get_id" webkit_dom_gamepad_get_id :: 
    Ptr DOMGamepad ->                       -- self : TInterface (Name {namespace = "WebKit", name = "DOMGamepad"})
    IO CString

{- |
/No description available in the introspection data./
-}
dOMGamepadGetId ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMGamepad a) =>
    a
    {- ^ /@self@/: A 'GI.WebKit.Objects.DOMGamepad.DOMGamepad' -}
    -> m T.Text
    {- ^ __Returns:__ A @/gchar/@ -}
dOMGamepadGetId self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- webkit_dom_gamepad_get_id self'
    checkUnexpectedReturnNULL "dOMGamepadGetId" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr self
    return result'

data DOMGamepadGetIdMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsDOMGamepad a) => O.MethodInfo DOMGamepadGetIdMethodInfo a signature where
    overloadedMethod _ = dOMGamepadGetId

-- method DOMGamepad::get_index
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "WebKit", name = "DOMGamepad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #WebKitDOMGamepad", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TULong)
-- throws : False
-- Skip return : False

foreign import ccall "webkit_dom_gamepad_get_index" webkit_dom_gamepad_get_index :: 
    Ptr DOMGamepad ->                       -- self : TInterface (Name {namespace = "WebKit", name = "DOMGamepad"})
    IO CULong

{- |
/No description available in the introspection data./
-}
dOMGamepadGetIndex ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMGamepad a) =>
    a
    {- ^ /@self@/: A 'GI.WebKit.Objects.DOMGamepad.DOMGamepad' -}
    -> m CULong
    {- ^ __Returns:__ A @/gulong/@ -}
dOMGamepadGetIndex self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- webkit_dom_gamepad_get_index self'
    touchManagedPtr self
    return result

data DOMGamepadGetIndexMethodInfo
instance (signature ~ (m CULong), MonadIO m, IsDOMGamepad a) => O.MethodInfo DOMGamepadGetIndexMethodInfo a signature where
    overloadedMethod _ = dOMGamepadGetIndex

-- method DOMGamepad::get_timestamp
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "WebKit", name = "DOMGamepad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #WebKitDOMGamepad", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt64)
-- throws : False
-- Skip return : False

foreign import ccall "webkit_dom_gamepad_get_timestamp" webkit_dom_gamepad_get_timestamp :: 
    Ptr DOMGamepad ->                       -- self : TInterface (Name {namespace = "WebKit", name = "DOMGamepad"})
    IO Word64

{- |
/No description available in the introspection data./
-}
dOMGamepadGetTimestamp ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMGamepad a) =>
    a
    {- ^ /@self@/: A 'GI.WebKit.Objects.DOMGamepad.DOMGamepad' -}
    -> m Word64
    {- ^ __Returns:__ A @/guint64/@ -}
dOMGamepadGetTimestamp self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- webkit_dom_gamepad_get_timestamp self'
    touchManagedPtr self
    return result

data DOMGamepadGetTimestampMethodInfo
instance (signature ~ (m Word64), MonadIO m, IsDOMGamepad a) => O.MethodInfo DOMGamepadGetTimestampMethodInfo a signature where
    overloadedMethod _ = dOMGamepadGetTimestamp