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

-- * Exported types
    DOMPerformanceEntry(..)                 ,
    DOMPerformanceEntryK                    ,
    toDOMPerformanceEntry                   ,
    noDOMPerformanceEntry                   ,


 -- * Methods
-- ** dOMPerformanceEntryGetDuration
    dOMPerformanceEntryGetDuration          ,


-- ** dOMPerformanceEntryGetEntryType
    dOMPerformanceEntryGetEntryType         ,


-- ** dOMPerformanceEntryGetName
    dOMPerformanceEntryGetName              ,


-- ** dOMPerformanceEntryGetStartTime
    dOMPerformanceEntryGetStartTime         ,




 -- * Properties
-- ** Duration
    DOMPerformanceEntryDurationPropertyInfo ,
    getDOMPerformanceEntryDuration          ,


-- ** EntryType
    DOMPerformanceEntryEntryTypePropertyInfo,
    getDOMPerformanceEntryEntryType         ,


-- ** Name
    DOMPerformanceEntryNamePropertyInfo     ,
    getDOMPerformanceEntryName              ,


-- ** StartTime
    DOMPerformanceEntryStartTimePropertyInfo,
    getDOMPerformanceEntryStartTime         ,




    ) 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.WebKit.Types
import GI.WebKit.Callbacks
import qualified GI.GObject as GObject

newtype DOMPerformanceEntry = DOMPerformanceEntry (ForeignPtr DOMPerformanceEntry)
foreign import ccall "webkit_dom_performance_entry_get_type"
    c_webkit_dom_performance_entry_get_type :: IO GType

type instance ParentTypes DOMPerformanceEntry = DOMPerformanceEntryParentTypes
type DOMPerformanceEntryParentTypes = '[DOMObject, GObject.Object]

instance GObject DOMPerformanceEntry where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_webkit_dom_performance_entry_get_type
    

class GObject o => DOMPerformanceEntryK o
instance (GObject o, IsDescendantOf DOMPerformanceEntry o) => DOMPerformanceEntryK o

toDOMPerformanceEntry :: DOMPerformanceEntryK o => o -> IO DOMPerformanceEntry
toDOMPerformanceEntry = unsafeCastTo DOMPerformanceEntry

noDOMPerformanceEntry :: Maybe DOMPerformanceEntry
noDOMPerformanceEntry = Nothing

-- VVV Prop "duration"
   -- Type: TBasicType TDouble
   -- Flags: [PropertyReadable]

getDOMPerformanceEntryDuration :: (MonadIO m, DOMPerformanceEntryK o) => o -> m Double
getDOMPerformanceEntryDuration obj = liftIO $ getObjectPropertyDouble obj "duration"

data DOMPerformanceEntryDurationPropertyInfo
instance AttrInfo DOMPerformanceEntryDurationPropertyInfo where
    type AttrAllowedOps DOMPerformanceEntryDurationPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DOMPerformanceEntryDurationPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMPerformanceEntryDurationPropertyInfo = DOMPerformanceEntryK
    type AttrGetType DOMPerformanceEntryDurationPropertyInfo = Double
    type AttrLabel DOMPerformanceEntryDurationPropertyInfo = "DOMPerformanceEntry::duration"
    attrGet _ = getDOMPerformanceEntryDuration
    attrSet _ = undefined
    attrConstruct _ = undefined

-- VVV Prop "entry-type"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable]

getDOMPerformanceEntryEntryType :: (MonadIO m, DOMPerformanceEntryK o) => o -> m T.Text
getDOMPerformanceEntryEntryType obj = liftIO $ getObjectPropertyString obj "entry-type"

data DOMPerformanceEntryEntryTypePropertyInfo
instance AttrInfo DOMPerformanceEntryEntryTypePropertyInfo where
    type AttrAllowedOps DOMPerformanceEntryEntryTypePropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DOMPerformanceEntryEntryTypePropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMPerformanceEntryEntryTypePropertyInfo = DOMPerformanceEntryK
    type AttrGetType DOMPerformanceEntryEntryTypePropertyInfo = T.Text
    type AttrLabel DOMPerformanceEntryEntryTypePropertyInfo = "DOMPerformanceEntry::entry-type"
    attrGet _ = getDOMPerformanceEntryEntryType
    attrSet _ = undefined
    attrConstruct _ = undefined

-- VVV Prop "name"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable]

getDOMPerformanceEntryName :: (MonadIO m, DOMPerformanceEntryK o) => o -> m T.Text
getDOMPerformanceEntryName obj = liftIO $ getObjectPropertyString obj "name"

data DOMPerformanceEntryNamePropertyInfo
instance AttrInfo DOMPerformanceEntryNamePropertyInfo where
    type AttrAllowedOps DOMPerformanceEntryNamePropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DOMPerformanceEntryNamePropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMPerformanceEntryNamePropertyInfo = DOMPerformanceEntryK
    type AttrGetType DOMPerformanceEntryNamePropertyInfo = T.Text
    type AttrLabel DOMPerformanceEntryNamePropertyInfo = "DOMPerformanceEntry::name"
    attrGet _ = getDOMPerformanceEntryName
    attrSet _ = undefined
    attrConstruct _ = undefined

-- VVV Prop "start-time"
   -- Type: TBasicType TDouble
   -- Flags: [PropertyReadable]

getDOMPerformanceEntryStartTime :: (MonadIO m, DOMPerformanceEntryK o) => o -> m Double
getDOMPerformanceEntryStartTime obj = liftIO $ getObjectPropertyDouble obj "start-time"

data DOMPerformanceEntryStartTimePropertyInfo
instance AttrInfo DOMPerformanceEntryStartTimePropertyInfo where
    type AttrAllowedOps DOMPerformanceEntryStartTimePropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DOMPerformanceEntryStartTimePropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMPerformanceEntryStartTimePropertyInfo = DOMPerformanceEntryK
    type AttrGetType DOMPerformanceEntryStartTimePropertyInfo = Double
    type AttrLabel DOMPerformanceEntryStartTimePropertyInfo = "DOMPerformanceEntry::start-time"
    attrGet _ = getDOMPerformanceEntryStartTime
    attrSet _ = undefined
    attrConstruct _ = undefined

type instance AttributeList DOMPerformanceEntry = DOMPerformanceEntryAttributeList
type DOMPerformanceEntryAttributeList = ('[ '("core-object", DOMObjectCoreObjectPropertyInfo), '("duration", DOMPerformanceEntryDurationPropertyInfo), '("entry-type", DOMPerformanceEntryEntryTypePropertyInfo), '("name", DOMPerformanceEntryNamePropertyInfo), '("start-time", DOMPerformanceEntryStartTimePropertyInfo)] :: [(Symbol, *)])

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

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

foreign import ccall "webkit_dom_performance_entry_get_duration" webkit_dom_performance_entry_get_duration :: 
    Ptr DOMPerformanceEntry ->              -- _obj : TInterface "WebKit" "DOMPerformanceEntry"
    IO CDouble


dOMPerformanceEntryGetDuration ::
    (MonadIO m, DOMPerformanceEntryK a) =>
    a ->                                    -- _obj
    m Double
dOMPerformanceEntryGetDuration _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_dom_performance_entry_get_duration _obj'
    let result' = realToFrac result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "webkit_dom_performance_entry_get_entry_type" webkit_dom_performance_entry_get_entry_type :: 
    Ptr DOMPerformanceEntry ->              -- _obj : TInterface "WebKit" "DOMPerformanceEntry"
    IO CString


dOMPerformanceEntryGetEntryType ::
    (MonadIO m, DOMPerformanceEntryK a) =>
    a ->                                    -- _obj
    m T.Text
dOMPerformanceEntryGetEntryType _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_dom_performance_entry_get_entry_type _obj'
    checkUnexpectedReturnNULL "webkit_dom_performance_entry_get_entry_type" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "webkit_dom_performance_entry_get_name" webkit_dom_performance_entry_get_name :: 
    Ptr DOMPerformanceEntry ->              -- _obj : TInterface "WebKit" "DOMPerformanceEntry"
    IO CString


dOMPerformanceEntryGetName ::
    (MonadIO m, DOMPerformanceEntryK a) =>
    a ->                                    -- _obj
    m T.Text
dOMPerformanceEntryGetName _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_dom_performance_entry_get_name _obj'
    checkUnexpectedReturnNULL "webkit_dom_performance_entry_get_name" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "webkit_dom_performance_entry_get_start_time" webkit_dom_performance_entry_get_start_time :: 
    Ptr DOMPerformanceEntry ->              -- _obj : TInterface "WebKit" "DOMPerformanceEntry"
    IO CDouble


dOMPerformanceEntryGetStartTime ::
    (MonadIO m, DOMPerformanceEntryK a) =>
    a ->                                    -- _obj
    m Double
dOMPerformanceEntryGetStartTime _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_dom_performance_entry_get_start_time _obj'
    let result' = realToFrac result
    touchManagedPtr _obj
    return result'