{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- t'GI.OSTree.Structs.RepoFinderResult.RepoFinderResult' gives a single result from an
-- 'GI.OSTree.Interfaces.RepoFinder.repoFinderResolveAsync' or 'GI.OSTree.Functions.repoFinderResolveAllAsync'
-- operation. This represents a single remote which provides none, some or all
-- of the refs being resolved. The structure includes various bits of metadata
-- which allow 'GI.OSTree.Objects.Repo.repoPullFromRemotesAsync' (for example) to prioritise
-- how to pull the refs.
-- 
-- An t'GI.OSTree.Structs.RepoFinderResult.RepoFinderResult' is immutable after construction.
-- 
-- The /@priority@/ is used as one input of many to ordering functions like
-- 'GI.OSTree.Structs.RepoFinderResult.repoFinderResultCompare'.
-- 
-- /@refToChecksum@/ indicates which refs (out of the ones queried for as inputs
-- to 'GI.OSTree.Interfaces.RepoFinder.repoFinderResolveAsync') are provided by this remote. The refs
-- are present as keys (of type t'GI.OSTree.Structs.CollectionRef.CollectionRef'), and the corresponding values
-- are the checksums of the commits the remote currently has for those refs. (These
-- might not be the latest commits available out of all results.) A
-- checksum may be 'P.Nothing' if the remote does not advertise the corresponding ref.
-- After 'GI.OSTree.Interfaces.RepoFinder.repoFinderResolveAsync' has been called, the commit metadata
-- should be available locally, so the details for each checksum can be looked
-- up using 'GI.OSTree.Objects.Repo.repoLoadCommit'.
-- 
-- /@refToTimestamp@/ provides timestamps for the set of refs in
-- /@refToChecksum@/. The refs are keys (of type t'GI.OSTree.Structs.CollectionRef.CollectionRef') and the
-- values are guint64 pointers with the timestamp associated with the checksum
-- provided in /@refToChecksum@/. /@refToTimestamp@/ can be 'P.Nothing', and when it\'s
-- not, the timestamps are zero when any of the following conditions are met:
-- (1) the override-commit-ids option was used on
-- ostree_repo_find_remotes_async (2) there was an error in trying to get the
-- commit metadata (3) the checksum for this ref is 'P.Nothing' in /@refToChecksum@/.
-- 
-- /Since: 2018.6/

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

module GI.OSTree.Structs.RepoFinderResult
    (

-- * Exported types
    RepoFinderResult(..)                    ,
    newZeroRepoFinderResult                 ,
    noRepoFinderResult                      ,


 -- * Methods
-- ** Overloaded methods #method:Overloaded methods#

#if defined(ENABLE_OVERLOADING)
    ResolveRepoFinderResultMethod           ,
#endif


-- ** compare #method:compare#

#if defined(ENABLE_OVERLOADING)
    RepoFinderResultCompareMethodInfo       ,
#endif
    repoFinderResultCompare                 ,


-- ** dup #method:dup#

#if defined(ENABLE_OVERLOADING)
    RepoFinderResultDupMethodInfo           ,
#endif
    repoFinderResultDup                     ,


-- ** free #method:free#

#if defined(ENABLE_OVERLOADING)
    RepoFinderResultFreeMethodInfo          ,
#endif
    repoFinderResultFree                    ,


-- ** freev #method:freev#

    repoFinderResultFreev                   ,




 -- * Properties
-- ** finder #attr:finder#
-- | the t'GI.OSTree.Interfaces.RepoFinder.RepoFinder' instance which produced this result

    clearRepoFinderResultFinder             ,
    getRepoFinderResultFinder               ,
#if defined(ENABLE_OVERLOADING)
    repoFinderResult_finder                 ,
#endif
    setRepoFinderResultFinder               ,


-- ** priority #attr:priority#
-- | static priority of the result, where higher numbers indicate lower
--    priority

    getRepoFinderResultPriority             ,
#if defined(ENABLE_OVERLOADING)
    repoFinderResult_priority               ,
#endif
    setRepoFinderResultPriority             ,


-- ** remote #attr:remote#
-- | t'GI.OSTree.Structs.Remote.Remote' which contains the transport details for the result,
--    such as its URI and GPG key

    clearRepoFinderResultRemote             ,
    getRepoFinderResultRemote               ,
#if defined(ENABLE_OVERLOADING)
    repoFinderResult_remote                 ,
#endif
    setRepoFinderResultRemote               ,


-- ** summaryLastModified #attr:summaryLastModified#
-- | Unix timestamp (seconds since the epoch, UTC) when
--    the summary file on the remote was last modified, or @0@ if unknown

    getRepoFinderResultSummaryLastModified  ,
#if defined(ENABLE_OVERLOADING)
    repoFinderResult_summaryLastModified    ,
#endif
    setRepoFinderResultSummaryLastModified  ,




    ) 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.GI.Base.Signals as B.Signals
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

import {-# SOURCE #-} qualified GI.OSTree.Interfaces.RepoFinder as OSTree.RepoFinder
import {-# SOURCE #-} qualified GI.OSTree.Structs.Remote as OSTree.Remote

-- | Memory-managed wrapper type.
newtype RepoFinderResult = RepoFinderResult (ManagedPtr RepoFinderResult)
    deriving (Eq)
foreign import ccall "ostree_repo_finder_result_get_type" c_ostree_repo_finder_result_get_type ::
    IO GType

instance BoxedObject RepoFinderResult where
    boxedType _ = c_ostree_repo_finder_result_get_type

-- | Convert 'RepoFinderResult' to and from 'Data.GI.Base.GValue.GValue' with 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue RepoFinderResult where
    toGValue o = do
        gtype <- c_ostree_repo_finder_result_get_type
        B.ManagedPtr.withManagedPtr o (B.GValue.buildGValue gtype B.GValue.set_boxed)

    fromGValue gv = do
        ptr <- B.GValue.get_boxed gv :: IO (Ptr RepoFinderResult)
        B.ManagedPtr.newBoxed RepoFinderResult ptr



-- | Construct a `RepoFinderResult` struct initialized to zero.
newZeroRepoFinderResult :: MonadIO m => m RepoFinderResult
newZeroRepoFinderResult = liftIO $ callocBoxedBytes 40 >>= wrapBoxed RepoFinderResult

instance tag ~ 'AttrSet => Constructible RepoFinderResult tag where
    new _ attrs = do
        o <- newZeroRepoFinderResult
        GI.Attributes.set o attrs
        return o


-- | A convenience alias for `Nothing` :: `Maybe` `RepoFinderResult`.
noRepoFinderResult :: Maybe RepoFinderResult
noRepoFinderResult = Nothing

-- | Get the value of the “@remote@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' repoFinderResult #remote
-- @
getRepoFinderResultRemote :: MonadIO m => RepoFinderResult -> m (Maybe OSTree.Remote.Remote)
getRepoFinderResultRemote s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 0) :: IO (Ptr OSTree.Remote.Remote)
    result <- SP.convertIfNonNull val $ \val' -> do
        val'' <- (newBoxed OSTree.Remote.Remote) val'
        return val''
    return result

-- | Set the value of the “@remote@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' repoFinderResult [ #remote 'Data.GI.Base.Attributes.:=' value ]
-- @
setRepoFinderResultRemote :: MonadIO m => RepoFinderResult -> Ptr OSTree.Remote.Remote -> m ()
setRepoFinderResultRemote s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 0) (val :: Ptr OSTree.Remote.Remote)

-- | Set the value of the “@remote@” field to `Nothing`.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.clear' #remote
-- @
clearRepoFinderResultRemote :: MonadIO m => RepoFinderResult -> m ()
clearRepoFinderResultRemote s = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 0) (FP.nullPtr :: Ptr OSTree.Remote.Remote)

#if defined(ENABLE_OVERLOADING)
data RepoFinderResultRemoteFieldInfo
instance AttrInfo RepoFinderResultRemoteFieldInfo where
    type AttrBaseTypeConstraint RepoFinderResultRemoteFieldInfo = (~) RepoFinderResult
    type AttrAllowedOps RepoFinderResultRemoteFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint RepoFinderResultRemoteFieldInfo = (~) (Ptr OSTree.Remote.Remote)
    type AttrTransferTypeConstraint RepoFinderResultRemoteFieldInfo = (~)(Ptr OSTree.Remote.Remote)
    type AttrTransferType RepoFinderResultRemoteFieldInfo = (Ptr OSTree.Remote.Remote)
    type AttrGetType RepoFinderResultRemoteFieldInfo = Maybe OSTree.Remote.Remote
    type AttrLabel RepoFinderResultRemoteFieldInfo = "remote"
    type AttrOrigin RepoFinderResultRemoteFieldInfo = RepoFinderResult
    attrGet = getRepoFinderResultRemote
    attrSet = setRepoFinderResultRemote
    attrConstruct = undefined
    attrClear = clearRepoFinderResultRemote
    attrTransfer _ v = do
        return v

repoFinderResult_remote :: AttrLabelProxy "remote"
repoFinderResult_remote = AttrLabelProxy

#endif


-- | Get the value of the “@finder@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' repoFinderResult #finder
-- @
getRepoFinderResultFinder :: MonadIO m => RepoFinderResult -> m (Maybe OSTree.RepoFinder.RepoFinder)
getRepoFinderResultFinder s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 4) :: IO (Ptr OSTree.RepoFinder.RepoFinder)
    result <- SP.convertIfNonNull val $ \val' -> do
        val'' <- (newObject OSTree.RepoFinder.RepoFinder) val'
        return val''
    return result

-- | Set the value of the “@finder@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' repoFinderResult [ #finder 'Data.GI.Base.Attributes.:=' value ]
-- @
setRepoFinderResultFinder :: MonadIO m => RepoFinderResult -> Ptr OSTree.RepoFinder.RepoFinder -> m ()
setRepoFinderResultFinder s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 4) (val :: Ptr OSTree.RepoFinder.RepoFinder)

-- | Set the value of the “@finder@” field to `Nothing`.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.clear' #finder
-- @
clearRepoFinderResultFinder :: MonadIO m => RepoFinderResult -> m ()
clearRepoFinderResultFinder s = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 4) (FP.nullPtr :: Ptr OSTree.RepoFinder.RepoFinder)

#if defined(ENABLE_OVERLOADING)
data RepoFinderResultFinderFieldInfo
instance AttrInfo RepoFinderResultFinderFieldInfo where
    type AttrBaseTypeConstraint RepoFinderResultFinderFieldInfo = (~) RepoFinderResult
    type AttrAllowedOps RepoFinderResultFinderFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint RepoFinderResultFinderFieldInfo = (~) (Ptr OSTree.RepoFinder.RepoFinder)
    type AttrTransferTypeConstraint RepoFinderResultFinderFieldInfo = (~)(Ptr OSTree.RepoFinder.RepoFinder)
    type AttrTransferType RepoFinderResultFinderFieldInfo = (Ptr OSTree.RepoFinder.RepoFinder)
    type AttrGetType RepoFinderResultFinderFieldInfo = Maybe OSTree.RepoFinder.RepoFinder
    type AttrLabel RepoFinderResultFinderFieldInfo = "finder"
    type AttrOrigin RepoFinderResultFinderFieldInfo = RepoFinderResult
    attrGet = getRepoFinderResultFinder
    attrSet = setRepoFinderResultFinder
    attrConstruct = undefined
    attrClear = clearRepoFinderResultFinder
    attrTransfer _ v = do
        return v

repoFinderResult_finder :: AttrLabelProxy "finder"
repoFinderResult_finder = AttrLabelProxy

#endif


-- | Get the value of the “@priority@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' repoFinderResult #priority
-- @
getRepoFinderResultPriority :: MonadIO m => RepoFinderResult -> m Int32
getRepoFinderResultPriority s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 8) :: IO Int32
    return val

-- | Set the value of the “@priority@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' repoFinderResult [ #priority 'Data.GI.Base.Attributes.:=' value ]
-- @
setRepoFinderResultPriority :: MonadIO m => RepoFinderResult -> Int32 -> m ()
setRepoFinderResultPriority s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 8) (val :: Int32)

#if defined(ENABLE_OVERLOADING)
data RepoFinderResultPriorityFieldInfo
instance AttrInfo RepoFinderResultPriorityFieldInfo where
    type AttrBaseTypeConstraint RepoFinderResultPriorityFieldInfo = (~) RepoFinderResult
    type AttrAllowedOps RepoFinderResultPriorityFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint RepoFinderResultPriorityFieldInfo = (~) Int32
    type AttrTransferTypeConstraint RepoFinderResultPriorityFieldInfo = (~)Int32
    type AttrTransferType RepoFinderResultPriorityFieldInfo = Int32
    type AttrGetType RepoFinderResultPriorityFieldInfo = Int32
    type AttrLabel RepoFinderResultPriorityFieldInfo = "priority"
    type AttrOrigin RepoFinderResultPriorityFieldInfo = RepoFinderResult
    attrGet = getRepoFinderResultPriority
    attrSet = setRepoFinderResultPriority
    attrConstruct = undefined
    attrClear = undefined
    attrTransfer _ v = do
        return v

repoFinderResult_priority :: AttrLabelProxy "priority"
repoFinderResult_priority = AttrLabelProxy

#endif


-- XXX Skipped attribute for "RepoFinderResult:ref_to_checksum" :: Not implemented: "GHashTable element of type TInterface (Name {namespace = \"OSTree\", name = \"CollectionRef\"}) unsupported."
-- | Get the value of the “@summary_last_modified@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' repoFinderResult #summaryLastModified
-- @
getRepoFinderResultSummaryLastModified :: MonadIO m => RepoFinderResult -> m Word64
getRepoFinderResultSummaryLastModified s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 16) :: IO Word64
    return val

-- | Set the value of the “@summary_last_modified@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' repoFinderResult [ #summaryLastModified 'Data.GI.Base.Attributes.:=' value ]
-- @
setRepoFinderResultSummaryLastModified :: MonadIO m => RepoFinderResult -> Word64 -> m ()
setRepoFinderResultSummaryLastModified s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 16) (val :: Word64)

#if defined(ENABLE_OVERLOADING)
data RepoFinderResultSummaryLastModifiedFieldInfo
instance AttrInfo RepoFinderResultSummaryLastModifiedFieldInfo where
    type AttrBaseTypeConstraint RepoFinderResultSummaryLastModifiedFieldInfo = (~) RepoFinderResult
    type AttrAllowedOps RepoFinderResultSummaryLastModifiedFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint RepoFinderResultSummaryLastModifiedFieldInfo = (~) Word64
    type AttrTransferTypeConstraint RepoFinderResultSummaryLastModifiedFieldInfo = (~)Word64
    type AttrTransferType RepoFinderResultSummaryLastModifiedFieldInfo = Word64
    type AttrGetType RepoFinderResultSummaryLastModifiedFieldInfo = Word64
    type AttrLabel RepoFinderResultSummaryLastModifiedFieldInfo = "summary_last_modified"
    type AttrOrigin RepoFinderResultSummaryLastModifiedFieldInfo = RepoFinderResult
    attrGet = getRepoFinderResultSummaryLastModified
    attrSet = setRepoFinderResultSummaryLastModified
    attrConstruct = undefined
    attrClear = undefined
    attrTransfer _ v = do
        return v

repoFinderResult_summaryLastModified :: AttrLabelProxy "summaryLastModified"
repoFinderResult_summaryLastModified = AttrLabelProxy

#endif


-- XXX Skipped attribute for "RepoFinderResult:ref_to_timestamp" :: Not implemented: "GHashTable element of type TInterface (Name {namespace = \"OSTree\", name = \"CollectionRef\"}) unsupported."

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList RepoFinderResult
type instance O.AttributeList RepoFinderResult = RepoFinderResultAttributeList
type RepoFinderResultAttributeList = ('[ '("remote", RepoFinderResultRemoteFieldInfo), '("finder", RepoFinderResultFinderFieldInfo), '("priority", RepoFinderResultPriorityFieldInfo), '("summaryLastModified", RepoFinderResultSummaryLastModifiedFieldInfo)] :: [(Symbol, *)])
#endif

-- XXX Could not generate method RepoFinderResult::new
-- Error was : Not implemented: "GHashTable key of type TInterface (Name {namespace = \"OSTree\", name = \"CollectionRef\"}) unsupported."
-- method RepoFinderResult::compare
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "a"
--           , argType =
--               TInterface
--                 Name { namespace = "OSTree" , name = "RepoFinderResult" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #OstreeRepoFinderResult"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "b"
--           , argType =
--               TInterface
--                 Name { namespace = "OSTree" , name = "RepoFinderResult" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #OstreeRepoFinderResult"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "ostree_repo_finder_result_compare" ostree_repo_finder_result_compare ::
    Ptr RepoFinderResult ->                 -- a : TInterface (Name {namespace = "OSTree", name = "RepoFinderResult"})
    Ptr RepoFinderResult ->                 -- b : TInterface (Name {namespace = "OSTree", name = "RepoFinderResult"})
    IO Int32

-- | Compare two t'GI.OSTree.Structs.RepoFinderResult.RepoFinderResult' instances to work out which one is better
-- to pull from, and hence needs to be ordered before the other.
-- 
-- /Since: 2018.6/
repoFinderResultCompare ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    RepoFinderResult
    -- ^ /@a@/: an t'GI.OSTree.Structs.RepoFinderResult.RepoFinderResult'
    -> RepoFinderResult
    -- ^ /@b@/: an t'GI.OSTree.Structs.RepoFinderResult.RepoFinderResult'
    -> m Int32
    -- ^ __Returns:__ \<0 if /@a@/ is ordered before /@b@/, 0 if they are ordered equally,
    --    >0 if /@b@/ is ordered before /@a@/
repoFinderResultCompare a b = liftIO $ do
    a' <- unsafeManagedPtrGetPtr a
    b' <- unsafeManagedPtrGetPtr b
    result <- ostree_repo_finder_result_compare a' b'
    touchManagedPtr a
    touchManagedPtr b
    return result

#if defined(ENABLE_OVERLOADING)
data RepoFinderResultCompareMethodInfo
instance (signature ~ (RepoFinderResult -> m Int32), MonadIO m) => O.MethodInfo RepoFinderResultCompareMethodInfo RepoFinderResult signature where
    overloadedMethod = repoFinderResultCompare

#endif

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

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

-- | Copy an t'GI.OSTree.Structs.RepoFinderResult.RepoFinderResult'.
-- 
-- /Since: 2018.6/
repoFinderResultDup ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    RepoFinderResult
    -- ^ /@result@/: an t'GI.OSTree.Structs.RepoFinderResult.RepoFinderResult' to copy
    -> m RepoFinderResult
    -- ^ __Returns:__ a newly allocated copy of /@result@/
repoFinderResultDup result_ = liftIO $ do
    result_' <- unsafeManagedPtrGetPtr result_
    result <- ostree_repo_finder_result_dup result_'
    checkUnexpectedReturnNULL "repoFinderResultDup" result
    result' <- (wrapBoxed RepoFinderResult) result
    touchManagedPtr result_
    return result'

#if defined(ENABLE_OVERLOADING)
data RepoFinderResultDupMethodInfo
instance (signature ~ (m RepoFinderResult), MonadIO m) => O.MethodInfo RepoFinderResultDupMethodInfo RepoFinderResult signature where
    overloadedMethod = repoFinderResultDup

#endif

-- method RepoFinderResult::free
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "result"
--           , argType =
--               TInterface
--                 Name { namespace = "OSTree" , name = "RepoFinderResult" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #OstreeRepoFinderResult"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

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

-- | Free the given /@result@/.
-- 
-- /Since: 2018.6/
repoFinderResultFree ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    RepoFinderResult
    -- ^ /@result@/: an t'GI.OSTree.Structs.RepoFinderResult.RepoFinderResult'
    -> m ()
repoFinderResultFree result_ = liftIO $ do
    result_' <- B.ManagedPtr.disownBoxed result_
    ostree_repo_finder_result_free result_'
    touchManagedPtr result_
    return ()

#if defined(ENABLE_OVERLOADING)
data RepoFinderResultFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo RepoFinderResultFreeMethodInfo RepoFinderResult signature where
    overloadedMethod = repoFinderResultFree

#endif

-- method RepoFinderResult::freev
-- method type : MemberFunction
-- Args: [ Arg
--           { argCName = "results"
--           , argType =
--               TCArray
--                 True
--                 (-1)
--                 (-1)
--                 (TInterface
--                    Name { namespace = "OSTree" , name = "RepoFinderResult" })
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an #OstreeRepoFinderResult"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "ostree_repo_finder_result_freev" ostree_repo_finder_result_freev ::
    Ptr (Ptr RepoFinderResult) ->           -- results : TCArray True (-1) (-1) (TInterface (Name {namespace = "OSTree", name = "RepoFinderResult"}))
    IO ()

-- | Free the given /@results@/ array, freeing each element and the container.
-- 
-- /Since: 2018.6/
repoFinderResultFreev ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    [RepoFinderResult]
    -- ^ /@results@/: an t'GI.OSTree.Structs.RepoFinderResult.RepoFinderResult'
    -> m ()
repoFinderResultFreev results = liftIO $ do
    results' <- mapM B.ManagedPtr.disownBoxed results
    results'' <- packZeroTerminatedPtrArray results'
    ostree_repo_finder_result_freev results''
    mapM_ touchManagedPtr results
    return ()

#if defined(ENABLE_OVERLOADING)
#endif

#if defined(ENABLE_OVERLOADING)
type family ResolveRepoFinderResultMethod (t :: Symbol) (o :: *) :: * where
    ResolveRepoFinderResultMethod "compare" o = RepoFinderResultCompareMethodInfo
    ResolveRepoFinderResultMethod "dup" o = RepoFinderResultDupMethodInfo
    ResolveRepoFinderResultMethod "free" o = RepoFinderResultFreeMethodInfo
    ResolveRepoFinderResultMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveRepoFinderResultMethod t RepoFinderResult, O.MethodInfo info RepoFinderResult p) => OL.IsLabel t (RepoFinderResult -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#endif