{- |
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.WebKit2.Objects.ResponsePolicyDecision
    ( 

-- * Exported types
    ResponsePolicyDecision(..)              ,
    ResponsePolicyDecisionK                 ,
    toResponsePolicyDecision                ,
    noResponsePolicyDecision                ,


 -- * Methods
-- ** responsePolicyDecisionGetRequest
    responsePolicyDecisionGetRequest        ,


-- ** responsePolicyDecisionGetResponse
    responsePolicyDecisionGetResponse       ,


-- ** responsePolicyDecisionIsMimeTypeSupported
    responsePolicyDecisionIsMimeTypeSupported,




 -- * Properties
-- ** Request
    ResponsePolicyDecisionRequestPropertyInfo,
    getResponsePolicyDecisionRequest        ,


-- ** Response
    ResponsePolicyDecisionResponsePropertyInfo,
    getResponsePolicyDecisionResponse       ,




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

newtype ResponsePolicyDecision = ResponsePolicyDecision (ForeignPtr ResponsePolicyDecision)
foreign import ccall "webkit_response_policy_decision_get_type"
    c_webkit_response_policy_decision_get_type :: IO GType

type instance ParentTypes ResponsePolicyDecision = ResponsePolicyDecisionParentTypes
type ResponsePolicyDecisionParentTypes = '[PolicyDecision, GObject.Object]

instance GObject ResponsePolicyDecision where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_webkit_response_policy_decision_get_type
    

class GObject o => ResponsePolicyDecisionK o
instance (GObject o, IsDescendantOf ResponsePolicyDecision o) => ResponsePolicyDecisionK o

toResponsePolicyDecision :: ResponsePolicyDecisionK o => o -> IO ResponsePolicyDecision
toResponsePolicyDecision = unsafeCastTo ResponsePolicyDecision

noResponsePolicyDecision :: Maybe ResponsePolicyDecision
noResponsePolicyDecision = Nothing

-- VVV Prop "request"
   -- Type: TInterface "WebKit2" "URIRequest"
   -- Flags: [PropertyReadable]

getResponsePolicyDecisionRequest :: (MonadIO m, ResponsePolicyDecisionK o) => o -> m URIRequest
getResponsePolicyDecisionRequest obj = liftIO $ getObjectPropertyObject obj "request" URIRequest

data ResponsePolicyDecisionRequestPropertyInfo
instance AttrInfo ResponsePolicyDecisionRequestPropertyInfo where
    type AttrAllowedOps ResponsePolicyDecisionRequestPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint ResponsePolicyDecisionRequestPropertyInfo = (~) ()
    type AttrBaseTypeConstraint ResponsePolicyDecisionRequestPropertyInfo = ResponsePolicyDecisionK
    type AttrGetType ResponsePolicyDecisionRequestPropertyInfo = URIRequest
    type AttrLabel ResponsePolicyDecisionRequestPropertyInfo = "ResponsePolicyDecision::request"
    attrGet _ = getResponsePolicyDecisionRequest
    attrSet _ = undefined
    attrConstruct _ = undefined

-- VVV Prop "response"
   -- Type: TInterface "WebKit2" "URIResponse"
   -- Flags: [PropertyReadable]

getResponsePolicyDecisionResponse :: (MonadIO m, ResponsePolicyDecisionK o) => o -> m URIResponse
getResponsePolicyDecisionResponse obj = liftIO $ getObjectPropertyObject obj "response" URIResponse

data ResponsePolicyDecisionResponsePropertyInfo
instance AttrInfo ResponsePolicyDecisionResponsePropertyInfo where
    type AttrAllowedOps ResponsePolicyDecisionResponsePropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint ResponsePolicyDecisionResponsePropertyInfo = (~) ()
    type AttrBaseTypeConstraint ResponsePolicyDecisionResponsePropertyInfo = ResponsePolicyDecisionK
    type AttrGetType ResponsePolicyDecisionResponsePropertyInfo = URIResponse
    type AttrLabel ResponsePolicyDecisionResponsePropertyInfo = "ResponsePolicyDecision::response"
    attrGet _ = getResponsePolicyDecisionResponse
    attrSet _ = undefined
    attrConstruct _ = undefined

type instance AttributeList ResponsePolicyDecision = ResponsePolicyDecisionAttributeList
type ResponsePolicyDecisionAttributeList = ('[ '("request", ResponsePolicyDecisionRequestPropertyInfo), '("response", ResponsePolicyDecisionResponsePropertyInfo)] :: [(Symbol, *)])

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

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

foreign import ccall "webkit_response_policy_decision_get_request" webkit_response_policy_decision_get_request :: 
    Ptr ResponsePolicyDecision ->           -- _obj : TInterface "WebKit2" "ResponsePolicyDecision"
    IO (Ptr URIRequest)


responsePolicyDecisionGetRequest ::
    (MonadIO m, ResponsePolicyDecisionK a) =>
    a ->                                    -- _obj
    m URIRequest
responsePolicyDecisionGetRequest _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_response_policy_decision_get_request _obj'
    checkUnexpectedReturnNULL "webkit_response_policy_decision_get_request" result
    result' <- (newObject URIRequest) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "webkit_response_policy_decision_get_response" webkit_response_policy_decision_get_response :: 
    Ptr ResponsePolicyDecision ->           -- _obj : TInterface "WebKit2" "ResponsePolicyDecision"
    IO (Ptr URIResponse)


responsePolicyDecisionGetResponse ::
    (MonadIO m, ResponsePolicyDecisionK a) =>
    a ->                                    -- _obj
    m URIResponse
responsePolicyDecisionGetResponse _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_response_policy_decision_get_response _obj'
    checkUnexpectedReturnNULL "webkit_response_policy_decision_get_response" result
    result' <- (newObject URIResponse) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "webkit_response_policy_decision_is_mime_type_supported" webkit_response_policy_decision_is_mime_type_supported :: 
    Ptr ResponsePolicyDecision ->           -- _obj : TInterface "WebKit2" "ResponsePolicyDecision"
    IO CInt


responsePolicyDecisionIsMimeTypeSupported ::
    (MonadIO m, ResponsePolicyDecisionK a) =>
    a ->                                    -- _obj
    m Bool
responsePolicyDecisionIsMimeTypeSupported _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_response_policy_decision_is_mime_type_supported _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'