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

-- * Exported types
    WebDatabase(..)                         ,
    WebDatabaseK                            ,
    toWebDatabase                           ,
    noWebDatabase                           ,


 -- * Methods
-- ** webDatabaseGetDisplayName
    webDatabaseGetDisplayName               ,


-- ** webDatabaseGetExpectedSize
    webDatabaseGetExpectedSize              ,


-- ** webDatabaseGetFilename
    webDatabaseGetFilename                  ,


-- ** webDatabaseGetName
    webDatabaseGetName                      ,


-- ** webDatabaseGetSecurityOrigin
    webDatabaseGetSecurityOrigin            ,


-- ** webDatabaseGetSize
    webDatabaseGetSize                      ,


-- ** webDatabaseRemove
    webDatabaseRemove                       ,




 -- * Properties
-- ** DisplayName
    WebDatabaseDisplayNamePropertyInfo      ,
    getWebDatabaseDisplayName               ,


-- ** ExpectedSize
    WebDatabaseExpectedSizePropertyInfo     ,
    getWebDatabaseExpectedSize              ,


-- ** Filename
    WebDatabaseFilenamePropertyInfo         ,
    getWebDatabaseFilename                  ,


-- ** Name
    WebDatabaseNamePropertyInfo             ,
    constructWebDatabaseName                ,
    getWebDatabaseName                      ,


-- ** SecurityOrigin
    WebDatabaseSecurityOriginPropertyInfo   ,
    constructWebDatabaseSecurityOrigin      ,
    getWebDatabaseSecurityOrigin            ,


-- ** Size
    WebDatabaseSizePropertyInfo             ,
    getWebDatabaseSize                      ,




    ) 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 WebDatabase = WebDatabase (ForeignPtr WebDatabase)
foreign import ccall "webkit_web_database_get_type"
    c_webkit_web_database_get_type :: IO GType

type instance ParentTypes WebDatabase = WebDatabaseParentTypes
type WebDatabaseParentTypes = '[GObject.Object]

instance GObject WebDatabase where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_webkit_web_database_get_type
    

class GObject o => WebDatabaseK o
instance (GObject o, IsDescendantOf WebDatabase o) => WebDatabaseK o

toWebDatabase :: WebDatabaseK o => o -> IO WebDatabase
toWebDatabase = unsafeCastTo WebDatabase

noWebDatabase :: Maybe WebDatabase
noWebDatabase = Nothing

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

getWebDatabaseDisplayName :: (MonadIO m, WebDatabaseK o) => o -> m T.Text
getWebDatabaseDisplayName obj = liftIO $ getObjectPropertyString obj "display-name"

data WebDatabaseDisplayNamePropertyInfo
instance AttrInfo WebDatabaseDisplayNamePropertyInfo where
    type AttrAllowedOps WebDatabaseDisplayNamePropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint WebDatabaseDisplayNamePropertyInfo = (~) ()
    type AttrBaseTypeConstraint WebDatabaseDisplayNamePropertyInfo = WebDatabaseK
    type AttrGetType WebDatabaseDisplayNamePropertyInfo = T.Text
    type AttrLabel WebDatabaseDisplayNamePropertyInfo = "WebDatabase::display-name"
    attrGet _ = getWebDatabaseDisplayName
    attrSet _ = undefined
    attrConstruct _ = undefined

-- VVV Prop "expected-size"
   -- Type: TBasicType TUInt64
   -- Flags: [PropertyReadable]

getWebDatabaseExpectedSize :: (MonadIO m, WebDatabaseK o) => o -> m Word64
getWebDatabaseExpectedSize obj = liftIO $ getObjectPropertyUInt64 obj "expected-size"

data WebDatabaseExpectedSizePropertyInfo
instance AttrInfo WebDatabaseExpectedSizePropertyInfo where
    type AttrAllowedOps WebDatabaseExpectedSizePropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint WebDatabaseExpectedSizePropertyInfo = (~) ()
    type AttrBaseTypeConstraint WebDatabaseExpectedSizePropertyInfo = WebDatabaseK
    type AttrGetType WebDatabaseExpectedSizePropertyInfo = Word64
    type AttrLabel WebDatabaseExpectedSizePropertyInfo = "WebDatabase::expected-size"
    attrGet _ = getWebDatabaseExpectedSize
    attrSet _ = undefined
    attrConstruct _ = undefined

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

getWebDatabaseFilename :: (MonadIO m, WebDatabaseK o) => o -> m T.Text
getWebDatabaseFilename obj = liftIO $ getObjectPropertyString obj "filename"

data WebDatabaseFilenamePropertyInfo
instance AttrInfo WebDatabaseFilenamePropertyInfo where
    type AttrAllowedOps WebDatabaseFilenamePropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint WebDatabaseFilenamePropertyInfo = (~) ()
    type AttrBaseTypeConstraint WebDatabaseFilenamePropertyInfo = WebDatabaseK
    type AttrGetType WebDatabaseFilenamePropertyInfo = T.Text
    type AttrLabel WebDatabaseFilenamePropertyInfo = "WebDatabase::filename"
    attrGet _ = getWebDatabaseFilename
    attrSet _ = undefined
    attrConstruct _ = undefined

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

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

constructWebDatabaseName :: T.Text -> IO ([Char], GValue)
constructWebDatabaseName val = constructObjectPropertyString "name" val

data WebDatabaseNamePropertyInfo
instance AttrInfo WebDatabaseNamePropertyInfo where
    type AttrAllowedOps WebDatabaseNamePropertyInfo = '[ 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint WebDatabaseNamePropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint WebDatabaseNamePropertyInfo = WebDatabaseK
    type AttrGetType WebDatabaseNamePropertyInfo = T.Text
    type AttrLabel WebDatabaseNamePropertyInfo = "WebDatabase::name"
    attrGet _ = getWebDatabaseName
    attrSet _ = undefined
    attrConstruct _ = constructWebDatabaseName

-- VVV Prop "security-origin"
   -- Type: TInterface "WebKit" "SecurityOrigin"
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]

getWebDatabaseSecurityOrigin :: (MonadIO m, WebDatabaseK o) => o -> m SecurityOrigin
getWebDatabaseSecurityOrigin obj = liftIO $ getObjectPropertyObject obj "security-origin" SecurityOrigin

constructWebDatabaseSecurityOrigin :: (SecurityOriginK a) => a -> IO ([Char], GValue)
constructWebDatabaseSecurityOrigin val = constructObjectPropertyObject "security-origin" val

data WebDatabaseSecurityOriginPropertyInfo
instance AttrInfo WebDatabaseSecurityOriginPropertyInfo where
    type AttrAllowedOps WebDatabaseSecurityOriginPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint WebDatabaseSecurityOriginPropertyInfo = SecurityOriginK
    type AttrBaseTypeConstraint WebDatabaseSecurityOriginPropertyInfo = WebDatabaseK
    type AttrGetType WebDatabaseSecurityOriginPropertyInfo = SecurityOrigin
    type AttrLabel WebDatabaseSecurityOriginPropertyInfo = "WebDatabase::security-origin"
    attrGet _ = getWebDatabaseSecurityOrigin
    attrSet _ = undefined
    attrConstruct _ = constructWebDatabaseSecurityOrigin

-- VVV Prop "size"
   -- Type: TBasicType TUInt64
   -- Flags: [PropertyReadable]

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

data WebDatabaseSizePropertyInfo
instance AttrInfo WebDatabaseSizePropertyInfo where
    type AttrAllowedOps WebDatabaseSizePropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint WebDatabaseSizePropertyInfo = (~) ()
    type AttrBaseTypeConstraint WebDatabaseSizePropertyInfo = WebDatabaseK
    type AttrGetType WebDatabaseSizePropertyInfo = Word64
    type AttrLabel WebDatabaseSizePropertyInfo = "WebDatabase::size"
    attrGet _ = getWebDatabaseSize
    attrSet _ = undefined
    attrConstruct _ = undefined

type instance AttributeList WebDatabase = WebDatabaseAttributeList
type WebDatabaseAttributeList = ('[ '("display-name", WebDatabaseDisplayNamePropertyInfo), '("expected-size", WebDatabaseExpectedSizePropertyInfo), '("filename", WebDatabaseFilenamePropertyInfo), '("name", WebDatabaseNamePropertyInfo), '("security-origin", WebDatabaseSecurityOriginPropertyInfo), '("size", WebDatabaseSizePropertyInfo)] :: [(Symbol, *)])

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

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

foreign import ccall "webkit_web_database_get_display_name" webkit_web_database_get_display_name :: 
    Ptr WebDatabase ->                      -- _obj : TInterface "WebKit" "WebDatabase"
    IO CString


webDatabaseGetDisplayName ::
    (MonadIO m, WebDatabaseK a) =>
    a ->                                    -- _obj
    m T.Text
webDatabaseGetDisplayName _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_web_database_get_display_name _obj'
    checkUnexpectedReturnNULL "webkit_web_database_get_display_name" result
    result' <- cstringToText result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "webkit_web_database_get_expected_size" webkit_web_database_get_expected_size :: 
    Ptr WebDatabase ->                      -- _obj : TInterface "WebKit" "WebDatabase"
    IO Word64


webDatabaseGetExpectedSize ::
    (MonadIO m, WebDatabaseK a) =>
    a ->                                    -- _obj
    m Word64
webDatabaseGetExpectedSize _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_web_database_get_expected_size _obj'
    touchManagedPtr _obj
    return result

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

foreign import ccall "webkit_web_database_get_filename" webkit_web_database_get_filename :: 
    Ptr WebDatabase ->                      -- _obj : TInterface "WebKit" "WebDatabase"
    IO CString


webDatabaseGetFilename ::
    (MonadIO m, WebDatabaseK a) =>
    a ->                                    -- _obj
    m T.Text
webDatabaseGetFilename _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_web_database_get_filename _obj'
    checkUnexpectedReturnNULL "webkit_web_database_get_filename" result
    result' <- cstringToText result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "webkit_web_database_get_name" webkit_web_database_get_name :: 
    Ptr WebDatabase ->                      -- _obj : TInterface "WebKit" "WebDatabase"
    IO CString


webDatabaseGetName ::
    (MonadIO m, WebDatabaseK a) =>
    a ->                                    -- _obj
    m T.Text
webDatabaseGetName _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_web_database_get_name _obj'
    checkUnexpectedReturnNULL "webkit_web_database_get_name" result
    result' <- cstringToText result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "webkit_web_database_get_security_origin" webkit_web_database_get_security_origin :: 
    Ptr WebDatabase ->                      -- _obj : TInterface "WebKit" "WebDatabase"
    IO (Ptr SecurityOrigin)


webDatabaseGetSecurityOrigin ::
    (MonadIO m, WebDatabaseK a) =>
    a ->                                    -- _obj
    m SecurityOrigin
webDatabaseGetSecurityOrigin _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_web_database_get_security_origin _obj'
    checkUnexpectedReturnNULL "webkit_web_database_get_security_origin" result
    result' <- (newObject SecurityOrigin) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "webkit_web_database_get_size" webkit_web_database_get_size :: 
    Ptr WebDatabase ->                      -- _obj : TInterface "WebKit" "WebDatabase"
    IO Word64


webDatabaseGetSize ::
    (MonadIO m, WebDatabaseK a) =>
    a ->                                    -- _obj
    m Word64
webDatabaseGetSize _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_web_database_get_size _obj'
    touchManagedPtr _obj
    return result

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

foreign import ccall "webkit_web_database_remove" webkit_web_database_remove :: 
    Ptr WebDatabase ->                      -- _obj : TInterface "WebKit" "WebDatabase"
    IO ()


webDatabaseRemove ::
    (MonadIO m, WebDatabaseK a) =>
    a ->                                    -- _obj
    m ()
webDatabaseRemove _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    webkit_web_database_remove _obj'
    touchManagedPtr _obj
    return ()