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

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


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


-- ** slice #method:slice#
    DOMBlobSliceMethodInfo                  ,
    dOMBlobSlice                            ,


-- ** webkitSlice #method:webkitSlice#
    DOMBlobWebkitSliceMethodInfo            ,
    dOMBlobWebkitSlice                      ,




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


-- ** type #attr:type#
    DOMBlobTypePropertyInfo                 ,
    dOMBlobType                             ,
    getDOMBlobType                          ,




    ) 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 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 WebKit.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 "slice" o = DOMBlobSliceMethodInfo
    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 "webkitSlice" o = DOMBlobWebkitSliceMethodInfo
    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

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

getDOMBlobType :: (MonadIO m, IsDOMBlob o) => o -> m (Maybe T.Text)
getDOMBlobType obj = liftIO $ getObjectPropertyString obj "type"

data DOMBlobTypePropertyInfo
instance AttrInfo DOMBlobTypePropertyInfo where
    type AttrAllowedOps DOMBlobTypePropertyInfo = '[ 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint DOMBlobTypePropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMBlobTypePropertyInfo = IsDOMBlob
    type AttrGetType DOMBlobTypePropertyInfo = (Maybe T.Text)
    type AttrLabel DOMBlobTypePropertyInfo = "type"
    type AttrOrigin DOMBlobTypePropertyInfo = DOMBlob
    attrGet _ = getDOMBlobType
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

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

dOMBlobSize :: AttrLabelProxy "size"
dOMBlobSize = AttrLabelProxy

dOMBlobType :: AttrLabelProxy "type"
dOMBlobType = 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 = "WebKit", 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 = "WebKit", name = "DOMBlob"})
    IO Word64

{- |
/No description available in the introspection data./
-}
dOMBlobGetSize ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMBlob a) =>
    a
    {- ^ /@self@/: A 'GI.WebKit.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

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

foreign import ccall "webkit_dom_blob_slice" webkit_dom_blob_slice :: 
    Ptr DOMBlob ->                          -- self : TInterface (Name {namespace = "WebKit", name = "DOMBlob"})
    Int64 ->                                -- start : TBasicType TInt64
    Int64 ->                                -- end : TBasicType TInt64
    CString ->                              -- contentType : TBasicType TUTF8
    IO (Ptr DOMBlob)

{- |
/No description available in the introspection data./
-}
dOMBlobSlice ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMBlob a) =>
    a
    {- ^ /@self@/: A 'GI.WebKit.Objects.DOMBlob.DOMBlob' -}
    -> Int64
    {- ^ /@start@/: A @/gint64/@ -}
    -> Int64
    {- ^ /@end@/: A @/gint64/@ -}
    -> T.Text
    {- ^ /@contentType@/: A @/gchar/@ -}
    -> m DOMBlob
    {- ^ __Returns:__ A 'GI.WebKit.Objects.DOMBlob.DOMBlob' -}
dOMBlobSlice self start end contentType = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    contentType' <- textToCString contentType
    result <- webkit_dom_blob_slice self' start end contentType'
    checkUnexpectedReturnNULL "dOMBlobSlice" result
    result' <- (wrapObject DOMBlob) result
    touchManagedPtr self
    freeMem contentType'
    return result'

data DOMBlobSliceMethodInfo
instance (signature ~ (Int64 -> Int64 -> T.Text -> m DOMBlob), MonadIO m, IsDOMBlob a) => O.MethodInfo DOMBlobSliceMethodInfo a signature where
    overloadedMethod _ = dOMBlobSlice

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

foreign import ccall "webkit_dom_blob_webkit_slice" webkit_dom_blob_webkit_slice :: 
    Ptr DOMBlob ->                          -- self : TInterface (Name {namespace = "WebKit", name = "DOMBlob"})
    Int64 ->                                -- start : TBasicType TInt64
    Int64 ->                                -- end : TBasicType TInt64
    CString ->                              -- content_type : TBasicType TUTF8
    IO (Ptr DOMBlob)

{-# DEPRECATED dOMBlobWebkitSlice ["(Since version 1.10)","Use 'GI.WebKit.Objects.DOMBlob.dOMBlobSlice' instead."] #-}
{- |
/No description available in the introspection data./
-}
dOMBlobWebkitSlice ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMBlob a) =>
    a
    {- ^ /@self@/: A 'GI.WebKit.Objects.DOMBlob.DOMBlob' -}
    -> Int64
    {- ^ /@start@/: A @/gint64/@ -}
    -> Int64
    {- ^ /@end@/: A @/gint64/@ -}
    -> T.Text
    {- ^ /@contentType@/: A @/gchar/@ -}
    -> m DOMBlob
    {- ^ __Returns:__ a 'GI.WebKit.Objects.DOMBlob.DOMBlob' -}
dOMBlobWebkitSlice self start end contentType = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    contentType' <- textToCString contentType
    result <- webkit_dom_blob_webkit_slice self' start end contentType'
    checkUnexpectedReturnNULL "dOMBlobWebkitSlice" result
    result' <- (newObject DOMBlob) result
    touchManagedPtr self
    freeMem contentType'
    return result'

data DOMBlobWebkitSliceMethodInfo
instance (signature ~ (Int64 -> Int64 -> T.Text -> m DOMBlob), MonadIO m, IsDOMBlob a) => O.MethodInfo DOMBlobWebkitSliceMethodInfo a signature where
    overloadedMethod _ = dOMBlobWebkitSlice