{- |
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.WebKit2WebExtension.Objects.DOMBlob
    ( 

-- * Exported types
    DOMBlob(..)                             ,
    IsDOMBlob                               ,
    toDOMBlob                               ,
    noDOMBlob                               ,


 -- * Methods
-- ** getSize #method:getSize#
    DOMBlobGetSizeMethodInfo                ,
    dOMBlobGetSize                          ,




 -- * Properties
-- ** size #attr:size#
    DOMBlobSizePropertyInfo                 ,
    dOMBlobSize                             ,
    getDOMBlobSize                          ,




    ) 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.WebKit2WebExtension.Objects.DOMObject as WebKit2WebExtension.DOMObject

newtype DOMBlob = DOMBlob (ManagedPtr DOMBlob)
foreign import ccall "webkit_dom_blob_get_type"
    c_webkit_dom_blob_get_type :: IO GType

instance GObject DOMBlob where
    gobjectType _ = c_webkit_dom_blob_get_type
    

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

toDOMBlob :: IsDOMBlob o => o -> IO DOMBlob
toDOMBlob = unsafeCastTo DOMBlob

noDOMBlob :: Maybe DOMBlob
noDOMBlob = Nothing

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

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

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

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

getDOMBlobSize :: (MonadIO m, IsDOMBlob o) => o -> m Word64
getDOMBlobSize obj = liftIO $ getObjectPropertyUInt64 obj "size"

data DOMBlobSizePropertyInfo
instance AttrInfo DOMBlobSizePropertyInfo where
    type AttrAllowedOps DOMBlobSizePropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DOMBlobSizePropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMBlobSizePropertyInfo = IsDOMBlob
    type AttrGetType DOMBlobSizePropertyInfo = Word64
    type AttrLabel DOMBlobSizePropertyInfo = "size"
    type AttrOrigin DOMBlobSizePropertyInfo = DOMBlob
    attrGet _ = getDOMBlobSize
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

instance O.HasAttributeList DOMBlob
type instance O.AttributeList DOMBlob = DOMBlobAttributeList
type DOMBlobAttributeList = ('[ '("coreObject", WebKit2WebExtension.DOMObject.DOMObjectCoreObjectPropertyInfo), '("size", DOMBlobSizePropertyInfo)] :: [(Symbol, *)])

dOMBlobSize :: AttrLabelProxy "size"
dOMBlobSize = AttrLabelProxy

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

-- method DOMBlob::get_size
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "WebKit2WebExtension", name = "DOMBlob"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #WebKitDOMBlob", 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_blob_get_size" webkit_dom_blob_get_size :: 
    Ptr DOMBlob ->                          -- self : TInterface (Name {namespace = "WebKit2WebExtension", name = "DOMBlob"})
    IO Word64

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

data DOMBlobGetSizeMethodInfo
instance (signature ~ (m Word64), MonadIO m, IsDOMBlob a) => O.MethodInfo DOMBlobGetSizeMethodInfo a signature where
    overloadedMethod _ = dOMBlobGetSize