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

/No description available in the introspection data./
-}

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

module GI.WebKit2WebExtension.Objects.DOMBlob
    (

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


 -- * Methods
-- ** getSize #method:getSize#

#if ENABLE_OVERLOADING
    DOMBlobGetSizeMethodInfo                ,
#endif
    dOMBlobGetSize                          ,




 -- * Properties
-- ** size #attr:size#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    DOMBlobSizePropertyInfo                 ,
#endif
#if ENABLE_OVERLOADING
    dOMBlobSize                             ,
#endif
    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.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
import {-# SOURCE #-} qualified GI.WebKit2WebExtension.Objects.DOMObject as WebKit2WebExtension.DOMObject

-- | Memory-managed wrapper type.
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


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

instance O.HasParentTypes DOMBlob
type instance O.ParentTypes DOMBlob = '[WebKit2WebExtension.DOMObject.DOMObject, GObject.Object.Object]

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

-- | A convenience alias for `Nothing` :: `Maybe` `DOMBlob`.
noDOMBlob :: Maybe DOMBlob
noDOMBlob = Nothing

#if ENABLE_OVERLOADING
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 "getv" o = GObject.Object.ObjectGetvMethodInfo
    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 "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) => OL.IsLabel t (DOMBlob -> 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

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

{- |
Get the value of the “@size@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' dOMBlob #size
@
-}
getDOMBlobSize :: (MonadIO m, IsDOMBlob o) => o -> m Word64
getDOMBlobSize obj = liftIO $ B.Properties.getObjectPropertyUInt64 obj "size"

#if ENABLE_OVERLOADING
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
#endif

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

#if ENABLE_OVERLOADING
dOMBlobSize :: AttrLabelProxy "size"
dOMBlobSize = AttrLabelProxy

#endif

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

#endif

-- 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

{-# DEPRECATED dOMBlobGetSize ["(Since version 2.22)","Use JavaScriptCore API instead"] #-}
{- |
/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

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

#endif