{- |
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.OSTree.Objects.GpgVerifyResult
    ( 

-- * Exported types
    GpgVerifyResult(..)                     ,
    IsGpgVerifyResult                       ,
    toGpgVerifyResult                       ,
    noGpgVerifyResult                       ,


 -- * Methods
-- ** countAll #method:countAll#
    GpgVerifyResultCountAllMethodInfo       ,
    gpgVerifyResultCountAll                 ,


-- ** countValid #method:countValid#
    GpgVerifyResultCountValidMethodInfo     ,
    gpgVerifyResultCountValid               ,


-- ** describe #method:describe#
    GpgVerifyResultDescribeMethodInfo       ,
    gpgVerifyResultDescribe                 ,


-- ** describeVariant #method:describeVariant#
    gpgVerifyResultDescribeVariant          ,


-- ** get #method:get#
    GpgVerifyResultGetMethodInfo            ,
    gpgVerifyResultGet                      ,


-- ** getAll #method:getAll#
    GpgVerifyResultGetAllMethodInfo         ,
    gpgVerifyResultGetAll                   ,


-- ** lookup #method:lookup#
    GpgVerifyResultLookupMethodInfo         ,
    gpgVerifyResultLookup                   ,


-- ** requireValidSignature #method:requireValidSignature#
    GpgVerifyResultRequireValidSignatureMethodInfo,
    gpgVerifyResultRequireValidSignature    ,




    ) 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.GLib.Structs.String as GLib.String
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Interfaces.Initable as Gio.Initable
import {-# SOURCE #-} qualified GI.OSTree.Enums as OSTree.Enums

newtype GpgVerifyResult = GpgVerifyResult (ManagedPtr GpgVerifyResult)
foreign import ccall "ostree_gpg_verify_result_get_type"
    c_ostree_gpg_verify_result_get_type :: IO GType

instance GObject GpgVerifyResult where
    gobjectType _ = c_ostree_gpg_verify_result_get_type
    

class GObject o => IsGpgVerifyResult o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError GpgVerifyResult a) =>
    IsGpgVerifyResult a
#endif
instance IsGpgVerifyResult GpgVerifyResult
instance GObject.Object.IsObject GpgVerifyResult
instance Gio.Initable.IsInitable GpgVerifyResult

toGpgVerifyResult :: IsGpgVerifyResult o => o -> IO GpgVerifyResult
toGpgVerifyResult = unsafeCastTo GpgVerifyResult

noGpgVerifyResult :: Maybe GpgVerifyResult
noGpgVerifyResult = Nothing

type family ResolveGpgVerifyResultMethod (t :: Symbol) (o :: *) :: * where
    ResolveGpgVerifyResultMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveGpgVerifyResultMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveGpgVerifyResultMethod "countAll" o = GpgVerifyResultCountAllMethodInfo
    ResolveGpgVerifyResultMethod "countValid" o = GpgVerifyResultCountValidMethodInfo
    ResolveGpgVerifyResultMethod "describe" o = GpgVerifyResultDescribeMethodInfo
    ResolveGpgVerifyResultMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveGpgVerifyResultMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveGpgVerifyResultMethod "get" o = GpgVerifyResultGetMethodInfo
    ResolveGpgVerifyResultMethod "init" o = Gio.Initable.InitableInitMethodInfo
    ResolveGpgVerifyResultMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveGpgVerifyResultMethod "lookup" o = GpgVerifyResultLookupMethodInfo
    ResolveGpgVerifyResultMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveGpgVerifyResultMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveGpgVerifyResultMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveGpgVerifyResultMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveGpgVerifyResultMethod "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
    ResolveGpgVerifyResultMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
    ResolveGpgVerifyResultMethod "requireValidSignature" o = GpgVerifyResultRequireValidSignatureMethodInfo
    ResolveGpgVerifyResultMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveGpgVerifyResultMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveGpgVerifyResultMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveGpgVerifyResultMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveGpgVerifyResultMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveGpgVerifyResultMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveGpgVerifyResultMethod "getAll" o = GpgVerifyResultGetAllMethodInfo
    ResolveGpgVerifyResultMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveGpgVerifyResultMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveGpgVerifyResultMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveGpgVerifyResultMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveGpgVerifyResultMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveGpgVerifyResultMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveGpgVerifyResultMethod t GpgVerifyResult, O.MethodInfo info GpgVerifyResult p) => O.IsLabelProxy t (GpgVerifyResult -> p) where
    fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveGpgVerifyResultMethod t GpgVerifyResult, O.MethodInfo info GpgVerifyResult p) => O.IsLabel t (GpgVerifyResult -> p) where
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

instance O.HasAttributeList GpgVerifyResult
type instance O.AttributeList GpgVerifyResult = GpgVerifyResultAttributeList
type GpgVerifyResultAttributeList = ('[ ] :: [(Symbol, *)])

type instance O.SignalList GpgVerifyResult = GpgVerifyResultSignalList
type GpgVerifyResultSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method GpgVerifyResult::count_all
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "result", argType = TInterface (Name {namespace = "OSTree", name = "GpgVerifyResult"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an #OstreeGpgVerifyResult", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "ostree_gpg_verify_result_count_all" ostree_gpg_verify_result_count_all :: 
    Ptr GpgVerifyResult ->                  -- result : TInterface (Name {namespace = "OSTree", name = "GpgVerifyResult"})
    IO Word32

{- |
Counts all the signatures in /@result@/.
-}
gpgVerifyResultCountAll ::
    (B.CallStack.HasCallStack, MonadIO m, IsGpgVerifyResult a) =>
    a
    {- ^ /@result@/: an 'GI.OSTree.Objects.GpgVerifyResult.GpgVerifyResult' -}
    -> m Word32
    {- ^ __Returns:__ signature count -}
gpgVerifyResultCountAll result_ = liftIO $ do
    result_' <- unsafeManagedPtrCastPtr result_
    result <- ostree_gpg_verify_result_count_all result_'
    touchManagedPtr result_
    return result

data GpgVerifyResultCountAllMethodInfo
instance (signature ~ (m Word32), MonadIO m, IsGpgVerifyResult a) => O.MethodInfo GpgVerifyResultCountAllMethodInfo a signature where
    overloadedMethod _ = gpgVerifyResultCountAll

-- method GpgVerifyResult::count_valid
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "result", argType = TInterface (Name {namespace = "OSTree", name = "GpgVerifyResult"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an #OstreeGpgVerifyResult", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "ostree_gpg_verify_result_count_valid" ostree_gpg_verify_result_count_valid :: 
    Ptr GpgVerifyResult ->                  -- result : TInterface (Name {namespace = "OSTree", name = "GpgVerifyResult"})
    IO Word32

{- |
Counts only the valid signatures in /@result@/.
-}
gpgVerifyResultCountValid ::
    (B.CallStack.HasCallStack, MonadIO m, IsGpgVerifyResult a) =>
    a
    {- ^ /@result@/: an 'GI.OSTree.Objects.GpgVerifyResult.GpgVerifyResult' -}
    -> m Word32
    {- ^ __Returns:__ valid signature count -}
gpgVerifyResultCountValid result_ = liftIO $ do
    result_' <- unsafeManagedPtrCastPtr result_
    result <- ostree_gpg_verify_result_count_valid result_'
    touchManagedPtr result_
    return result

data GpgVerifyResultCountValidMethodInfo
instance (signature ~ (m Word32), MonadIO m, IsGpgVerifyResult a) => O.MethodInfo GpgVerifyResultCountValidMethodInfo a signature where
    overloadedMethod _ = gpgVerifyResultCountValid

-- method GpgVerifyResult::describe
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "result", argType = TInterface (Name {namespace = "OSTree", name = "GpgVerifyResult"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an #OstreeGpgVerifyResult", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "signature_index", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "which signature to describe", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "output_buffer", argType = TInterface (Name {namespace = "GLib", name = "String"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GString to hold the description", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "line_prefix", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "optional line prefix string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "OSTree", name = "GpgSignatureFormatFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "flags to adjust the description format", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "ostree_gpg_verify_result_describe" ostree_gpg_verify_result_describe :: 
    Ptr GpgVerifyResult ->                  -- result : TInterface (Name {namespace = "OSTree", name = "GpgVerifyResult"})
    Word32 ->                               -- signature_index : TBasicType TUInt
    Ptr GLib.String.String ->               -- output_buffer : TInterface (Name {namespace = "GLib", name = "String"})
    CString ->                              -- line_prefix : TBasicType TUTF8
    CUInt ->                                -- flags : TInterface (Name {namespace = "OSTree", name = "GpgSignatureFormatFlags"})
    IO ()

{- |
Appends a brief, human-readable description of the GPG signature at
/@signatureIndex@/ in /@result@/ to the /@outputBuffer@/.  The description
spans multiple lines.  A /@linePrefix@/ string, if given, will precede
each line of the description.

The /@flags@/ argument is reserved for future variations to the description
format.  Currently must be 0.

It is a programmer error to request an invalid /@signatureIndex@/.  Use
'GI.OSTree.Objects.GpgVerifyResult.gpgVerifyResultCountAll' to find the number of signatures in
/@result@/.
-}
gpgVerifyResultDescribe ::
    (B.CallStack.HasCallStack, MonadIO m, IsGpgVerifyResult a) =>
    a
    {- ^ /@result@/: an 'GI.OSTree.Objects.GpgVerifyResult.GpgVerifyResult' -}
    -> Word32
    {- ^ /@signatureIndex@/: which signature to describe -}
    -> GLib.String.String
    {- ^ /@outputBuffer@/: a 'GI.GLib.Structs.String.String' to hold the description -}
    -> Maybe (T.Text)
    {- ^ /@linePrefix@/: optional line prefix string -}
    -> OSTree.Enums.GpgSignatureFormatFlags
    {- ^ /@flags@/: flags to adjust the description format -}
    -> m ()
gpgVerifyResultDescribe result_ signatureIndex outputBuffer linePrefix flags = liftIO $ do
    result_' <- unsafeManagedPtrCastPtr result_
    outputBuffer' <- unsafeManagedPtrGetPtr outputBuffer
    maybeLinePrefix <- case linePrefix of
        Nothing -> return nullPtr
        Just jLinePrefix -> do
            jLinePrefix' <- textToCString jLinePrefix
            return jLinePrefix'
    let flags' = (fromIntegral . fromEnum) flags
    ostree_gpg_verify_result_describe result_' signatureIndex outputBuffer' maybeLinePrefix flags'
    touchManagedPtr result_
    touchManagedPtr outputBuffer
    freeMem maybeLinePrefix
    return ()

data GpgVerifyResultDescribeMethodInfo
instance (signature ~ (Word32 -> GLib.String.String -> Maybe (T.Text) -> OSTree.Enums.GpgSignatureFormatFlags -> m ()), MonadIO m, IsGpgVerifyResult a) => O.MethodInfo GpgVerifyResultDescribeMethodInfo a signature where
    overloadedMethod _ = gpgVerifyResultDescribe

-- method GpgVerifyResult::get
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "result", argType = TInterface (Name {namespace = "OSTree", name = "GpgVerifyResult"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an #OstreeGpgVerifyResult", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "signature_index", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "which signature to get attributes from", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "attrs", argType = TCArray False (-1) 3 (TInterface (Name {namespace = "OSTree", name = "GpgSignatureAttr"})), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Array of requested attributes", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n_attrs", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Length of the @attrs array", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : [Arg {argCName = "n_attrs", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Length of the @attrs array", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- returnType : Just TVariant
-- throws : False
-- Skip return : False

foreign import ccall "ostree_gpg_verify_result_get" ostree_gpg_verify_result_get :: 
    Ptr GpgVerifyResult ->                  -- result : TInterface (Name {namespace = "OSTree", name = "GpgVerifyResult"})
    Word32 ->                               -- signature_index : TBasicType TUInt
    Ptr CUInt ->                            -- attrs : TCArray False (-1) 3 (TInterface (Name {namespace = "OSTree", name = "GpgSignatureAttr"}))
    Word32 ->                               -- n_attrs : TBasicType TUInt
    IO (Ptr GVariant)

{- |
Builds a 'GVariant' tuple of requested attributes for the GPG signature at
/@signatureIndex@/ in /@result@/.  See the 'GI.OSTree.Enums.GpgSignatureAttr' description
for the 'GI.GLib.Structs.VariantType.VariantType' of each available attribute.

It is a programmer error to request an invalid 'GI.OSTree.Enums.GpgSignatureAttr' or
an invalid /@signatureIndex@/.  Use 'GI.OSTree.Objects.GpgVerifyResult.gpgVerifyResultCountAll' to
find the number of signatures in /@result@/.
-}
gpgVerifyResultGet ::
    (B.CallStack.HasCallStack, MonadIO m, IsGpgVerifyResult a) =>
    a
    {- ^ /@result@/: an 'GI.OSTree.Objects.GpgVerifyResult.GpgVerifyResult' -}
    -> Word32
    {- ^ /@signatureIndex@/: which signature to get attributes from -}
    -> [OSTree.Enums.GpgSignatureAttr]
    {- ^ /@attrs@/: Array of requested attributes -}
    -> m GVariant
    {- ^ __Returns:__ a new, floating, 'GVariant' tuple -}
gpgVerifyResultGet result_ signatureIndex attrs = liftIO $ do
    let nAttrs = fromIntegral $ length attrs
    result_' <- unsafeManagedPtrCastPtr result_
    let attrs' = map (fromIntegral . fromEnum) attrs
    attrs'' <- packStorableArray attrs'
    result <- ostree_gpg_verify_result_get result_' signatureIndex attrs'' nAttrs
    checkUnexpectedReturnNULL "gpgVerifyResultGet" result
    result' <- wrapGVariantPtr result
    touchManagedPtr result_
    freeMem attrs''
    return result'

data GpgVerifyResultGetMethodInfo
instance (signature ~ (Word32 -> [OSTree.Enums.GpgSignatureAttr] -> m GVariant), MonadIO m, IsGpgVerifyResult a) => O.MethodInfo GpgVerifyResultGetMethodInfo a signature where
    overloadedMethod _ = gpgVerifyResultGet

-- method GpgVerifyResult::get_all
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "result", argType = TInterface (Name {namespace = "OSTree", name = "GpgVerifyResult"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an #OstreeGpgVerifyResult", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "signature_index", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "which signature to get attributes from", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just TVariant
-- throws : False
-- Skip return : False

foreign import ccall "ostree_gpg_verify_result_get_all" ostree_gpg_verify_result_get_all :: 
    Ptr GpgVerifyResult ->                  -- result : TInterface (Name {namespace = "OSTree", name = "GpgVerifyResult"})
    Word32 ->                               -- signature_index : TBasicType TUInt
    IO (Ptr GVariant)

{- |
Builds a 'GVariant' tuple of all available attributes for the GPG signature
at /@signatureIndex@/ in /@result@/.

The child values in the returned 'GVariant' tuple are ordered to match the
'GI.OSTree.Enums.GpgSignatureAttr' enumeration, which means the enum values can be
used as index values in functions like @/g_variant_get_child()/@.  See the
'GI.OSTree.Enums.GpgSignatureAttr' description for the 'GI.GLib.Structs.VariantType.VariantType' of each
available attribute.

\<note>
  \<para>
    The 'GI.OSTree.Enums.GpgSignatureAttr' enumeration may be extended in the future
    with new attributes, which would affect the 'GVariant' tuple returned by
    this function.  While the position and type of current child values in
    the 'GVariant' tuple will not change, to avoid backward-compatibility
    issues \<emphasis>please do not depend on the tuple\'s overall size or
    type signature\<\/emphasis>.
  \<\/para>
\<\/note>

It is a programmer error to request an invalid /@signatureIndex@/.  Use
'GI.OSTree.Objects.GpgVerifyResult.gpgVerifyResultCountAll' to find the number of signatures in
/@result@/.
-}
gpgVerifyResultGetAll ::
    (B.CallStack.HasCallStack, MonadIO m, IsGpgVerifyResult a) =>
    a
    {- ^ /@result@/: an 'GI.OSTree.Objects.GpgVerifyResult.GpgVerifyResult' -}
    -> Word32
    {- ^ /@signatureIndex@/: which signature to get attributes from -}
    -> m GVariant
    {- ^ __Returns:__ a new, floating, 'GVariant' tuple -}
gpgVerifyResultGetAll result_ signatureIndex = liftIO $ do
    result_' <- unsafeManagedPtrCastPtr result_
    result <- ostree_gpg_verify_result_get_all result_' signatureIndex
    checkUnexpectedReturnNULL "gpgVerifyResultGetAll" result
    result' <- wrapGVariantPtr result
    touchManagedPtr result_
    return result'

data GpgVerifyResultGetAllMethodInfo
instance (signature ~ (Word32 -> m GVariant), MonadIO m, IsGpgVerifyResult a) => O.MethodInfo GpgVerifyResultGetAllMethodInfo a signature where
    overloadedMethod _ = gpgVerifyResultGetAll

-- method GpgVerifyResult::lookup
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "result", argType = TInterface (Name {namespace = "OSTree", name = "GpgVerifyResult"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an #OstreeGpgVerifyResult", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "key_id", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a GPG key ID or fingerprint", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "out_signature_index", argType = TBasicType TUInt, direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "return location for the index of the signature\n                             signed by @key_id, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferEverything}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "ostree_gpg_verify_result_lookup" ostree_gpg_verify_result_lookup :: 
    Ptr GpgVerifyResult ->                  -- result : TInterface (Name {namespace = "OSTree", name = "GpgVerifyResult"})
    CString ->                              -- key_id : TBasicType TUTF8
    Ptr Word32 ->                           -- out_signature_index : TBasicType TUInt
    IO CInt

{- |
Searches /@result@/ for a signature signed by /@keyId@/.  If a match is found,
the function returns 'True' and sets /@outSignatureIndex@/ so that further
signature details can be obtained through 'GI.OSTree.Objects.GpgVerifyResult.gpgVerifyResultGet'.
If no match is found, the function returns 'False' and leaves
/@outSignatureIndex@/ unchanged.
-}
gpgVerifyResultLookup ::
    (B.CallStack.HasCallStack, MonadIO m, IsGpgVerifyResult a) =>
    a
    {- ^ /@result@/: an 'GI.OSTree.Objects.GpgVerifyResult.GpgVerifyResult' -}
    -> T.Text
    {- ^ /@keyId@/: a GPG key ID or fingerprint -}
    -> m (Bool,Word32)
    {- ^ __Returns:__ 'True' on success, 'False' on failure -}
gpgVerifyResultLookup result_ keyId = liftIO $ do
    result_' <- unsafeManagedPtrCastPtr result_
    keyId' <- textToCString keyId
    outSignatureIndex <- allocMem :: IO (Ptr Word32)
    result <- ostree_gpg_verify_result_lookup result_' keyId' outSignatureIndex
    let result' = (/= 0) result
    outSignatureIndex' <- peek outSignatureIndex
    touchManagedPtr result_
    freeMem keyId'
    freeMem outSignatureIndex
    return (result', outSignatureIndex')

data GpgVerifyResultLookupMethodInfo
instance (signature ~ (T.Text -> m (Bool,Word32)), MonadIO m, IsGpgVerifyResult a) => O.MethodInfo GpgVerifyResultLookupMethodInfo a signature where
    overloadedMethod _ = gpgVerifyResultLookup

-- method GpgVerifyResult::require_valid_signature
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "result", argType = TInterface (Name {namespace = "OSTree", name = "GpgVerifyResult"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "an #OstreeGpgVerifyResult", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "ostree_gpg_verify_result_require_valid_signature" ostree_gpg_verify_result_require_valid_signature :: 
    Ptr GpgVerifyResult ->                  -- result : TInterface (Name {namespace = "OSTree", name = "GpgVerifyResult"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{- |
Checks if the result contains at least one signature from the
trusted keyring.  You can call this function immediately after
'GI.OSTree.Objects.Repo.repoVerifySummary' or 'GI.OSTree.Objects.Repo.repoVerifyCommitExt' -
it will handle the 'Nothing' /@result@/ and filled /@error@/ too.
-}
gpgVerifyResultRequireValidSignature ::
    (B.CallStack.HasCallStack, MonadIO m, IsGpgVerifyResult a) =>
    a
    {- ^ /@result@/: an 'GI.OSTree.Objects.GpgVerifyResult.GpgVerifyResult' -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
gpgVerifyResultRequireValidSignature result_ = liftIO $ do
    result_' <- unsafeManagedPtrCastPtr result_
    onException (do
        _ <- propagateGError $ ostree_gpg_verify_result_require_valid_signature result_'
        touchManagedPtr result_
        return ()
     ) (do
        return ()
     )

data GpgVerifyResultRequireValidSignatureMethodInfo
instance (signature ~ (m ()), MonadIO m, IsGpgVerifyResult a) => O.MethodInfo GpgVerifyResultRequireValidSignatureMethodInfo a signature where
    overloadedMethod _ = gpgVerifyResultRequireValidSignature

-- method GpgVerifyResult::describe_variant
-- method type : MemberFunction
-- Args : [Arg {argCName = "variant", argType = TVariant, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GVariant from ostree_gpg_verify_result_get_all()", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "output_buffer", argType = TInterface (Name {namespace = "GLib", name = "String"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GString to hold the description", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "line_prefix", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "optional line prefix string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "flags", argType = TInterface (Name {namespace = "OSTree", name = "GpgSignatureFormatFlags"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "flags to adjust the description format", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "ostree_gpg_verify_result_describe_variant" ostree_gpg_verify_result_describe_variant :: 
    Ptr GVariant ->                         -- variant : TVariant
    Ptr GLib.String.String ->               -- output_buffer : TInterface (Name {namespace = "GLib", name = "String"})
    CString ->                              -- line_prefix : TBasicType TUTF8
    CUInt ->                                -- flags : TInterface (Name {namespace = "OSTree", name = "GpgSignatureFormatFlags"})
    IO ()

{- |
Similar to 'GI.OSTree.Objects.GpgVerifyResult.gpgVerifyResultDescribe' but takes a 'GVariant' of
all attributes for a GPG signature instead of an 'GI.OSTree.Objects.GpgVerifyResult.GpgVerifyResult'
and signature index.

The /@variant@/ \<emphasis>MUST\<\/emphasis> have been created by
'GI.OSTree.Objects.GpgVerifyResult.gpgVerifyResultGetAll'.
-}
gpgVerifyResultDescribeVariant ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GVariant
    {- ^ /@variant@/: a 'GVariant' from 'GI.OSTree.Objects.GpgVerifyResult.gpgVerifyResultGetAll' -}
    -> GLib.String.String
    {- ^ /@outputBuffer@/: a 'GI.GLib.Structs.String.String' to hold the description -}
    -> Maybe (T.Text)
    {- ^ /@linePrefix@/: optional line prefix string -}
    -> OSTree.Enums.GpgSignatureFormatFlags
    {- ^ /@flags@/: flags to adjust the description format -}
    -> m ()
gpgVerifyResultDescribeVariant variant outputBuffer linePrefix flags = liftIO $ do
    variant' <- unsafeManagedPtrGetPtr variant
    outputBuffer' <- unsafeManagedPtrGetPtr outputBuffer
    maybeLinePrefix <- case linePrefix of
        Nothing -> return nullPtr
        Just jLinePrefix -> do
            jLinePrefix' <- textToCString jLinePrefix
            return jLinePrefix'
    let flags' = (fromIntegral . fromEnum) flags
    ostree_gpg_verify_result_describe_variant variant' outputBuffer' maybeLinePrefix flags'
    touchManagedPtr variant
    touchManagedPtr outputBuffer
    freeMem maybeLinePrefix
    return ()