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

Represents a ssh interactive prompt.
-}

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

module GI.Ggit.Structs.CredSshInteractivePrompt
    (

-- * Exported types
    CredSshInteractivePrompt(..)            ,
    noCredSshInteractivePrompt              ,


 -- * Methods
-- ** getInstruction #method:getInstruction#

#if ENABLE_OVERLOADING
    CredSshInteractivePromptGetInstructionMethodInfo,
#endif
    credSshInteractivePromptGetInstruction  ,


-- ** getName #method:getName#

#if ENABLE_OVERLOADING
    CredSshInteractivePromptGetNameMethodInfo,
#endif
    credSshInteractivePromptGetName         ,


-- ** getResponse #method:getResponse#

#if ENABLE_OVERLOADING
    CredSshInteractivePromptGetResponseMethodInfo,
#endif
    credSshInteractivePromptGetResponse     ,


-- ** getText #method:getText#

#if ENABLE_OVERLOADING
    CredSshInteractivePromptGetTextMethodInfo,
#endif
    credSshInteractivePromptGetText         ,


-- ** isMasked #method:isMasked#

#if ENABLE_OVERLOADING
    CredSshInteractivePromptIsMaskedMethodInfo,
#endif
    credSshInteractivePromptIsMasked        ,


-- ** new #method:new#

    credSshInteractivePromptNew             ,


-- ** ref #method:ref#

#if ENABLE_OVERLOADING
    CredSshInteractivePromptRefMethodInfo   ,
#endif
    credSshInteractivePromptRef             ,


-- ** setResponse #method:setResponse#

#if ENABLE_OVERLOADING
    CredSshInteractivePromptSetResponseMethodInfo,
#endif
    credSshInteractivePromptSetResponse     ,


-- ** unref #method:unref#

#if ENABLE_OVERLOADING
    CredSshInteractivePromptUnrefMethodInfo ,
#endif
    credSshInteractivePromptUnref           ,




    ) 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


-- | Memory-managed wrapper type.
newtype CredSshInteractivePrompt = CredSshInteractivePrompt (ManagedPtr CredSshInteractivePrompt)
foreign import ccall "ggit_cred_ssh_interactive_prompt_get_type" c_ggit_cred_ssh_interactive_prompt_get_type ::
    IO GType

instance BoxedObject CredSshInteractivePrompt where
    boxedType _ = c_ggit_cred_ssh_interactive_prompt_get_type

-- | A convenience alias for `Nothing` :: `Maybe` `CredSshInteractivePrompt`.
noCredSshInteractivePrompt :: Maybe CredSshInteractivePrompt
noCredSshInteractivePrompt = Nothing


#if ENABLE_OVERLOADING
instance O.HasAttributeList CredSshInteractivePrompt
type instance O.AttributeList CredSshInteractivePrompt = CredSshInteractivePromptAttributeList
type CredSshInteractivePromptAttributeList = ('[ ] :: [(Symbol, *)])
#endif

-- method CredSshInteractivePrompt::new
-- method type : Constructor
-- Args : [Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "instruction", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "text", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "is_masked", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Ggit", name = "CredSshInteractivePrompt"}))
-- throws : False
-- Skip return : False

foreign import ccall "ggit_cred_ssh_interactive_prompt_new" ggit_cred_ssh_interactive_prompt_new ::
    CString ->                              -- name : TBasicType TUTF8
    CString ->                              -- instruction : TBasicType TUTF8
    CString ->                              -- text : TBasicType TUTF8
    CInt ->                                 -- is_masked : TBasicType TBoolean
    IO (Ptr CredSshInteractivePrompt)

{- |
/No description available in the introspection data./
-}
credSshInteractivePromptNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -> T.Text
    -> T.Text
    -> Bool
    -> m CredSshInteractivePrompt
credSshInteractivePromptNew name instruction text isMasked = liftIO $ do
    name' <- textToCString name
    instruction' <- textToCString instruction
    text' <- textToCString text
    let isMasked' = (fromIntegral . fromEnum) isMasked
    result <- ggit_cred_ssh_interactive_prompt_new name' instruction' text' isMasked'
    checkUnexpectedReturnNULL "credSshInteractivePromptNew" result
    result' <- (wrapBoxed CredSshInteractivePrompt) result
    freeMem name'
    freeMem instruction'
    freeMem text'
    return result'

#if ENABLE_OVERLOADING
#endif

-- method CredSshInteractivePrompt::get_instruction
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "prompt", argType = TInterface (Name {namespace = "Ggit", name = "CredSshInteractivePrompt"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "ggit_cred_ssh_interactive_prompt_get_instruction" ggit_cred_ssh_interactive_prompt_get_instruction ::
    Ptr CredSshInteractivePrompt ->         -- prompt : TInterface (Name {namespace = "Ggit", name = "CredSshInteractivePrompt"})
    IO CString

{- |
/No description available in the introspection data./
-}
credSshInteractivePromptGetInstruction ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    CredSshInteractivePrompt
    -> m T.Text
credSshInteractivePromptGetInstruction prompt = liftIO $ do
    prompt' <- unsafeManagedPtrGetPtr prompt
    result <- ggit_cred_ssh_interactive_prompt_get_instruction prompt'
    checkUnexpectedReturnNULL "credSshInteractivePromptGetInstruction" result
    result' <- cstringToText result
    touchManagedPtr prompt
    return result'

#if ENABLE_OVERLOADING
data CredSshInteractivePromptGetInstructionMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo CredSshInteractivePromptGetInstructionMethodInfo CredSshInteractivePrompt signature where
    overloadedMethod _ = credSshInteractivePromptGetInstruction

#endif

-- method CredSshInteractivePrompt::get_name
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "prompt", argType = TInterface (Name {namespace = "Ggit", name = "CredSshInteractivePrompt"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "ggit_cred_ssh_interactive_prompt_get_name" ggit_cred_ssh_interactive_prompt_get_name ::
    Ptr CredSshInteractivePrompt ->         -- prompt : TInterface (Name {namespace = "Ggit", name = "CredSshInteractivePrompt"})
    IO CString

{- |
/No description available in the introspection data./
-}
credSshInteractivePromptGetName ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    CredSshInteractivePrompt
    -> m T.Text
credSshInteractivePromptGetName prompt = liftIO $ do
    prompt' <- unsafeManagedPtrGetPtr prompt
    result <- ggit_cred_ssh_interactive_prompt_get_name prompt'
    checkUnexpectedReturnNULL "credSshInteractivePromptGetName" result
    result' <- cstringToText result
    touchManagedPtr prompt
    return result'

#if ENABLE_OVERLOADING
data CredSshInteractivePromptGetNameMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo CredSshInteractivePromptGetNameMethodInfo CredSshInteractivePrompt signature where
    overloadedMethod _ = credSshInteractivePromptGetName

#endif

-- method CredSshInteractivePrompt::get_response
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "prompt", argType = TInterface (Name {namespace = "Ggit", name = "CredSshInteractivePrompt"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "ggit_cred_ssh_interactive_prompt_get_response" ggit_cred_ssh_interactive_prompt_get_response ::
    Ptr CredSshInteractivePrompt ->         -- prompt : TInterface (Name {namespace = "Ggit", name = "CredSshInteractivePrompt"})
    IO CString

{- |
/No description available in the introspection data./
-}
credSshInteractivePromptGetResponse ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    CredSshInteractivePrompt
    -> m T.Text
credSshInteractivePromptGetResponse prompt = liftIO $ do
    prompt' <- unsafeManagedPtrGetPtr prompt
    result <- ggit_cred_ssh_interactive_prompt_get_response prompt'
    checkUnexpectedReturnNULL "credSshInteractivePromptGetResponse" result
    result' <- cstringToText result
    touchManagedPtr prompt
    return result'

#if ENABLE_OVERLOADING
data CredSshInteractivePromptGetResponseMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo CredSshInteractivePromptGetResponseMethodInfo CredSshInteractivePrompt signature where
    overloadedMethod _ = credSshInteractivePromptGetResponse

#endif

-- method CredSshInteractivePrompt::get_text
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "prompt", argType = TInterface (Name {namespace = "Ggit", name = "CredSshInteractivePrompt"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "ggit_cred_ssh_interactive_prompt_get_text" ggit_cred_ssh_interactive_prompt_get_text ::
    Ptr CredSshInteractivePrompt ->         -- prompt : TInterface (Name {namespace = "Ggit", name = "CredSshInteractivePrompt"})
    IO CString

{- |
/No description available in the introspection data./
-}
credSshInteractivePromptGetText ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    CredSshInteractivePrompt
    -> m T.Text
credSshInteractivePromptGetText prompt = liftIO $ do
    prompt' <- unsafeManagedPtrGetPtr prompt
    result <- ggit_cred_ssh_interactive_prompt_get_text prompt'
    checkUnexpectedReturnNULL "credSshInteractivePromptGetText" result
    result' <- cstringToText result
    touchManagedPtr prompt
    return result'

#if ENABLE_OVERLOADING
data CredSshInteractivePromptGetTextMethodInfo
instance (signature ~ (m T.Text), MonadIO m) => O.MethodInfo CredSshInteractivePromptGetTextMethodInfo CredSshInteractivePrompt signature where
    overloadedMethod _ = credSshInteractivePromptGetText

#endif

-- method CredSshInteractivePrompt::is_masked
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "prompt", argType = TInterface (Name {namespace = "Ggit", name = "CredSshInteractivePrompt"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "ggit_cred_ssh_interactive_prompt_is_masked" ggit_cred_ssh_interactive_prompt_is_masked ::
    Ptr CredSshInteractivePrompt ->         -- prompt : TInterface (Name {namespace = "Ggit", name = "CredSshInteractivePrompt"})
    IO CInt

{- |
/No description available in the introspection data./
-}
credSshInteractivePromptIsMasked ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    CredSshInteractivePrompt
    -> m Bool
credSshInteractivePromptIsMasked prompt = liftIO $ do
    prompt' <- unsafeManagedPtrGetPtr prompt
    result <- ggit_cred_ssh_interactive_prompt_is_masked prompt'
    let result' = (/= 0) result
    touchManagedPtr prompt
    return result'

#if ENABLE_OVERLOADING
data CredSshInteractivePromptIsMaskedMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.MethodInfo CredSshInteractivePromptIsMaskedMethodInfo CredSshInteractivePrompt signature where
    overloadedMethod _ = credSshInteractivePromptIsMasked

#endif

-- method CredSshInteractivePrompt::ref
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "prompt", argType = TInterface (Name {namespace = "Ggit", name = "CredSshInteractivePrompt"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Ggit", name = "CredSshInteractivePrompt"}))
-- throws : False
-- Skip return : False

foreign import ccall "ggit_cred_ssh_interactive_prompt_ref" ggit_cred_ssh_interactive_prompt_ref ::
    Ptr CredSshInteractivePrompt ->         -- prompt : TInterface (Name {namespace = "Ggit", name = "CredSshInteractivePrompt"})
    IO (Ptr CredSshInteractivePrompt)

{- |
/No description available in the introspection data./
-}
credSshInteractivePromptRef ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    CredSshInteractivePrompt
    -> m CredSshInteractivePrompt
credSshInteractivePromptRef prompt = liftIO $ do
    prompt' <- unsafeManagedPtrGetPtr prompt
    result <- ggit_cred_ssh_interactive_prompt_ref prompt'
    checkUnexpectedReturnNULL "credSshInteractivePromptRef" result
    result' <- (wrapBoxed CredSshInteractivePrompt) result
    touchManagedPtr prompt
    return result'

#if ENABLE_OVERLOADING
data CredSshInteractivePromptRefMethodInfo
instance (signature ~ (m CredSshInteractivePrompt), MonadIO m) => O.MethodInfo CredSshInteractivePromptRefMethodInfo CredSshInteractivePrompt signature where
    overloadedMethod _ = credSshInteractivePromptRef

#endif

-- method CredSshInteractivePrompt::set_response
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "prompt", argType = TInterface (Name {namespace = "Ggit", name = "CredSshInteractivePrompt"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "response", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "ggit_cred_ssh_interactive_prompt_set_response" ggit_cred_ssh_interactive_prompt_set_response ::
    Ptr CredSshInteractivePrompt ->         -- prompt : TInterface (Name {namespace = "Ggit", name = "CredSshInteractivePrompt"})
    CString ->                              -- response : TBasicType TUTF8
    IO ()

{- |
/No description available in the introspection data./
-}
credSshInteractivePromptSetResponse ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    CredSshInteractivePrompt
    -> T.Text
    -> m ()
credSshInteractivePromptSetResponse prompt response = liftIO $ do
    prompt' <- unsafeManagedPtrGetPtr prompt
    response' <- textToCString response
    ggit_cred_ssh_interactive_prompt_set_response prompt' response'
    touchManagedPtr prompt
    freeMem response'
    return ()

#if ENABLE_OVERLOADING
data CredSshInteractivePromptSetResponseMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m) => O.MethodInfo CredSshInteractivePromptSetResponseMethodInfo CredSshInteractivePrompt signature where
    overloadedMethod _ = credSshInteractivePromptSetResponse

#endif

-- method CredSshInteractivePrompt::unref
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "prompt", argType = TInterface (Name {namespace = "Ggit", name = "CredSshInteractivePrompt"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "ggit_cred_ssh_interactive_prompt_unref" ggit_cred_ssh_interactive_prompt_unref ::
    Ptr CredSshInteractivePrompt ->         -- prompt : TInterface (Name {namespace = "Ggit", name = "CredSshInteractivePrompt"})
    IO ()

{- |
/No description available in the introspection data./
-}
credSshInteractivePromptUnref ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    CredSshInteractivePrompt
    -> m ()
credSshInteractivePromptUnref prompt = liftIO $ do
    prompt' <- unsafeManagedPtrGetPtr prompt
    ggit_cred_ssh_interactive_prompt_unref prompt'
    touchManagedPtr prompt
    return ()

#if ENABLE_OVERLOADING
data CredSshInteractivePromptUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo CredSshInteractivePromptUnrefMethodInfo CredSshInteractivePrompt signature where
    overloadedMethod _ = credSshInteractivePromptUnref

#endif

#if ENABLE_OVERLOADING
type family ResolveCredSshInteractivePromptMethod (t :: Symbol) (o :: *) :: * where
    ResolveCredSshInteractivePromptMethod "isMasked" o = CredSshInteractivePromptIsMaskedMethodInfo
    ResolveCredSshInteractivePromptMethod "ref" o = CredSshInteractivePromptRefMethodInfo
    ResolveCredSshInteractivePromptMethod "unref" o = CredSshInteractivePromptUnrefMethodInfo
    ResolveCredSshInteractivePromptMethod "getInstruction" o = CredSshInteractivePromptGetInstructionMethodInfo
    ResolveCredSshInteractivePromptMethod "getName" o = CredSshInteractivePromptGetNameMethodInfo
    ResolveCredSshInteractivePromptMethod "getResponse" o = CredSshInteractivePromptGetResponseMethodInfo
    ResolveCredSshInteractivePromptMethod "getText" o = CredSshInteractivePromptGetTextMethodInfo
    ResolveCredSshInteractivePromptMethod "setResponse" o = CredSshInteractivePromptSetResponseMethodInfo
    ResolveCredSshInteractivePromptMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveCredSshInteractivePromptMethod t CredSshInteractivePrompt, O.MethodInfo info CredSshInteractivePrompt p) => OL.IsLabel t (CredSshInteractivePrompt -> 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