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

-- * Exported types
    DOMPerformance(..)                      ,
    IsDOMPerformance                        ,
    toDOMPerformance                        ,
    noDOMPerformance                        ,


 -- * Methods
-- ** getMemory #method:getMemory#
    DOMPerformanceGetMemoryMethodInfo       ,
    dOMPerformanceGetMemory                 ,


-- ** getNavigation #method:getNavigation#
    DOMPerformanceGetNavigationMethodInfo   ,
    dOMPerformanceGetNavigation             ,


-- ** getTiming #method:getTiming#
    DOMPerformanceGetTimingMethodInfo       ,
    dOMPerformanceGetTiming                 ,


-- ** now #method:now#
    DOMPerformanceNowMethodInfo             ,
    dOMPerformanceNow                       ,




 -- * Properties
-- ** navigation #attr:navigation#
    DOMPerformanceNavigationPropertyInfo    ,
    dOMPerformanceNavigation                ,
    getDOMPerformanceNavigation             ,


-- ** timing #attr:timing#
    DOMPerformanceTimingPropertyInfo        ,
    dOMPerformanceTiming                    ,
    getDOMPerformanceTiming                 ,




    ) 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.Interfaces.DOMEventTarget as WebKit.DOMEventTarget
import {-# SOURCE #-} qualified GI.WebKit.Objects.DOMObject as WebKit.DOMObject
import {-# SOURCE #-} qualified GI.WebKit.Objects.DOMPerformanceNavigation as WebKit.DOMPerformanceNavigation
import {-# SOURCE #-} qualified GI.WebKit.Objects.DOMPerformanceTiming as WebKit.DOMPerformanceTiming

newtype DOMPerformance = DOMPerformance (ManagedPtr DOMPerformance)
foreign import ccall "webkit_dom_performance_get_type"
    c_webkit_dom_performance_get_type :: IO GType

instance GObject DOMPerformance where
    gobjectType _ = c_webkit_dom_performance_get_type
    

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

toDOMPerformance :: IsDOMPerformance o => o -> IO DOMPerformance
toDOMPerformance = unsafeCastTo DOMPerformance

noDOMPerformance :: Maybe DOMPerformance
noDOMPerformance = Nothing

type family ResolveDOMPerformanceMethod (t :: Symbol) (o :: *) :: * where
    ResolveDOMPerformanceMethod "addEventListener" o = WebKit.DOMEventTarget.DOMEventTargetAddEventListenerMethodInfo
    ResolveDOMPerformanceMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveDOMPerformanceMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveDOMPerformanceMethod "dispatchEvent" o = WebKit.DOMEventTarget.DOMEventTargetDispatchEventMethodInfo
    ResolveDOMPerformanceMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveDOMPerformanceMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveDOMPerformanceMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveDOMPerformanceMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveDOMPerformanceMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveDOMPerformanceMethod "now" o = DOMPerformanceNowMethodInfo
    ResolveDOMPerformanceMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveDOMPerformanceMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveDOMPerformanceMethod "removeEventListener" o = WebKit.DOMEventTarget.DOMEventTargetRemoveEventListenerMethodInfo
    ResolveDOMPerformanceMethod "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
    ResolveDOMPerformanceMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
    ResolveDOMPerformanceMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveDOMPerformanceMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveDOMPerformanceMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveDOMPerformanceMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveDOMPerformanceMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveDOMPerformanceMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveDOMPerformanceMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveDOMPerformanceMethod "getMemory" o = DOMPerformanceGetMemoryMethodInfo
    ResolveDOMPerformanceMethod "getNavigation" o = DOMPerformanceGetNavigationMethodInfo
    ResolveDOMPerformanceMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveDOMPerformanceMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveDOMPerformanceMethod "getTiming" o = DOMPerformanceGetTimingMethodInfo
    ResolveDOMPerformanceMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveDOMPerformanceMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveDOMPerformanceMethod l o = O.MethodResolutionFailed l o

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

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

-- VVV Prop "navigation"
   -- Type: TInterface (Name {namespace = "WebKit", name = "DOMPerformanceNavigation"})
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

getDOMPerformanceNavigation :: (MonadIO m, IsDOMPerformance o) => o -> m (Maybe WebKit.DOMPerformanceNavigation.DOMPerformanceNavigation)
getDOMPerformanceNavigation obj = liftIO $ getObjectPropertyObject obj "navigation" WebKit.DOMPerformanceNavigation.DOMPerformanceNavigation

data DOMPerformanceNavigationPropertyInfo
instance AttrInfo DOMPerformanceNavigationPropertyInfo where
    type AttrAllowedOps DOMPerformanceNavigationPropertyInfo = '[ 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint DOMPerformanceNavigationPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMPerformanceNavigationPropertyInfo = IsDOMPerformance
    type AttrGetType DOMPerformanceNavigationPropertyInfo = (Maybe WebKit.DOMPerformanceNavigation.DOMPerformanceNavigation)
    type AttrLabel DOMPerformanceNavigationPropertyInfo = "navigation"
    type AttrOrigin DOMPerformanceNavigationPropertyInfo = DOMPerformance
    attrGet _ = getDOMPerformanceNavigation
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

-- VVV Prop "timing"
   -- Type: TInterface (Name {namespace = "WebKit", name = "DOMPerformanceTiming"})
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

getDOMPerformanceTiming :: (MonadIO m, IsDOMPerformance o) => o -> m (Maybe WebKit.DOMPerformanceTiming.DOMPerformanceTiming)
getDOMPerformanceTiming obj = liftIO $ getObjectPropertyObject obj "timing" WebKit.DOMPerformanceTiming.DOMPerformanceTiming

data DOMPerformanceTimingPropertyInfo
instance AttrInfo DOMPerformanceTimingPropertyInfo where
    type AttrAllowedOps DOMPerformanceTimingPropertyInfo = '[ 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint DOMPerformanceTimingPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMPerformanceTimingPropertyInfo = IsDOMPerformance
    type AttrGetType DOMPerformanceTimingPropertyInfo = (Maybe WebKit.DOMPerformanceTiming.DOMPerformanceTiming)
    type AttrLabel DOMPerformanceTimingPropertyInfo = "timing"
    type AttrOrigin DOMPerformanceTimingPropertyInfo = DOMPerformance
    attrGet _ = getDOMPerformanceTiming
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

instance O.HasAttributeList DOMPerformance
type instance O.AttributeList DOMPerformance = DOMPerformanceAttributeList
type DOMPerformanceAttributeList = ('[ '("coreObject", WebKit.DOMObject.DOMObjectCoreObjectPropertyInfo), '("navigation", DOMPerformanceNavigationPropertyInfo), '("timing", DOMPerformanceTimingPropertyInfo)] :: [(Symbol, *)])

dOMPerformanceNavigation :: AttrLabelProxy "navigation"
dOMPerformanceNavigation = AttrLabelProxy

dOMPerformanceTiming :: AttrLabelProxy "timing"
dOMPerformanceTiming = AttrLabelProxy

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

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

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

{-# DEPRECATED dOMPerformanceGetMemory ["(Since version 2.2)"] #-}
{- |
This functionality has been removed from WebKit, this function does nothing.
-}
dOMPerformanceGetMemory ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMPerformance a) =>
    a
    {- ^ /@self@/: A 'GI.WebKit.Objects.DOMPerformance.DOMPerformance' -}
    -> m (Ptr ())
dOMPerformanceGetMemory self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- webkit_dom_performance_get_memory self'
    touchManagedPtr self
    return result

data DOMPerformanceGetMemoryMethodInfo
instance (signature ~ (m (Ptr ())), MonadIO m, IsDOMPerformance a) => O.MethodInfo DOMPerformanceGetMemoryMethodInfo a signature where
    overloadedMethod _ = dOMPerformanceGetMemory

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

foreign import ccall "webkit_dom_performance_get_navigation" webkit_dom_performance_get_navigation :: 
    Ptr DOMPerformance ->                   -- self : TInterface (Name {namespace = "WebKit", name = "DOMPerformance"})
    IO (Ptr WebKit.DOMPerformanceNavigation.DOMPerformanceNavigation)

{- |
/No description available in the introspection data./
-}
dOMPerformanceGetNavigation ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMPerformance a) =>
    a
    {- ^ /@self@/: A 'GI.WebKit.Objects.DOMPerformance.DOMPerformance' -}
    -> m WebKit.DOMPerformanceNavigation.DOMPerformanceNavigation
    {- ^ __Returns:__ A 'GI.WebKit.Objects.DOMPerformanceNavigation.DOMPerformanceNavigation' -}
dOMPerformanceGetNavigation self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- webkit_dom_performance_get_navigation self'
    checkUnexpectedReturnNULL "dOMPerformanceGetNavigation" result
    result' <- (wrapObject WebKit.DOMPerformanceNavigation.DOMPerformanceNavigation) result
    touchManagedPtr self
    return result'

data DOMPerformanceGetNavigationMethodInfo
instance (signature ~ (m WebKit.DOMPerformanceNavigation.DOMPerformanceNavigation), MonadIO m, IsDOMPerformance a) => O.MethodInfo DOMPerformanceGetNavigationMethodInfo a signature where
    overloadedMethod _ = dOMPerformanceGetNavigation

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

foreign import ccall "webkit_dom_performance_get_timing" webkit_dom_performance_get_timing :: 
    Ptr DOMPerformance ->                   -- self : TInterface (Name {namespace = "WebKit", name = "DOMPerformance"})
    IO (Ptr WebKit.DOMPerformanceTiming.DOMPerformanceTiming)

{- |
/No description available in the introspection data./
-}
dOMPerformanceGetTiming ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMPerformance a) =>
    a
    {- ^ /@self@/: A 'GI.WebKit.Objects.DOMPerformance.DOMPerformance' -}
    -> m WebKit.DOMPerformanceTiming.DOMPerformanceTiming
    {- ^ __Returns:__ A 'GI.WebKit.Objects.DOMPerformanceTiming.DOMPerformanceTiming' -}
dOMPerformanceGetTiming self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- webkit_dom_performance_get_timing self'
    checkUnexpectedReturnNULL "dOMPerformanceGetTiming" result
    result' <- (wrapObject WebKit.DOMPerformanceTiming.DOMPerformanceTiming) result
    touchManagedPtr self
    return result'

data DOMPerformanceGetTimingMethodInfo
instance (signature ~ (m WebKit.DOMPerformanceTiming.DOMPerformanceTiming), MonadIO m, IsDOMPerformance a) => O.MethodInfo DOMPerformanceGetTimingMethodInfo a signature where
    overloadedMethod _ = dOMPerformanceGetTiming

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

foreign import ccall "webkit_dom_performance_now" webkit_dom_performance_now :: 
    Ptr DOMPerformance ->                   -- self : TInterface (Name {namespace = "WebKit", name = "DOMPerformance"})
    IO CDouble

{- |
/No description available in the introspection data./
-}
dOMPerformanceNow ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMPerformance a) =>
    a
    {- ^ /@self@/: A 'GI.WebKit.Objects.DOMPerformance.DOMPerformance' -}
    -> m Double
    {- ^ __Returns:__ A @/gdouble/@ -}
dOMPerformanceNow self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- webkit_dom_performance_now self'
    let result' = realToFrac result
    touchManagedPtr self
    return result'

data DOMPerformanceNowMethodInfo
instance (signature ~ (m Double), MonadIO m, IsDOMPerformance a) => O.MethodInfo DOMPerformanceNowMethodInfo a signature where
    overloadedMethod _ = dOMPerformanceNow