{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- Represents a set of attributes that are stored with an item. These schemas
-- are used for interoperability between various services storing the same types
-- of items.
-- 
-- Each schema has a name like \"org.gnome.keyring.NetworkPassword\", and defines
-- a set of attributes, and types (string, integer, boolean) for those attributes.
-- 
-- Attributes are stored as strings in the Secret Service, and the attribute
-- types simply define standard ways to store integer and boolean values as strings.
-- Attributes are represented in libsecret via a t'GI.GLib.Structs.HashTable.HashTable' with string keys and
-- values. Even for values that defined as an integer or boolean in the schema,
-- the attribute values in the t'GI.GLib.Structs.HashTable.HashTable' are strings. Boolean values are stored
-- as the strings \'true\' and \'false\'. Integer values are stored in decimal, with
-- a preceding negative sign for negative integers.
-- 
-- Schemas are handled entirely on the client side by this library. The name of the
-- schema is automatically stored as an attribute on the item.
-- 
-- Normally when looking up passwords only those with matching schema names are
-- returned. If the schema /@flags@/ contain the 'GI.Secret.Flags.SchemaFlagsDontMatchName' flag,
-- then lookups will not check that the schema name matches that on the item, only
-- the schema\'s attributes are matched. This is useful when you are looking up items
-- that are not stored by the libsecret library. Other libraries such as libgnome-keyring
-- don\'t store the schema name.

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

module GI.Secret.Structs.Schema
    ( 

-- * Exported types
    Schema(..)                              ,
    newZeroSchema                           ,


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

#if defined(ENABLE_OVERLOADING)
    ResolveSchemaMethod                     ,
#endif


-- ** ref #method:ref#

#if defined(ENABLE_OVERLOADING)
    SchemaRefMethodInfo                     ,
#endif
    schemaRef                               ,


-- ** unref #method:unref#

#if defined(ENABLE_OVERLOADING)
    SchemaUnrefMethodInfo                   ,
#endif
    schemaUnref                             ,




 -- * Properties
-- ** flags #attr:flags#
-- | flags for the schema

    getSchemaFlags                          ,
#if defined(ENABLE_OVERLOADING)
    schema_flags                            ,
#endif
    setSchemaFlags                          ,


-- ** name #attr:name#
-- | the dotted name of the schema

    clearSchemaName                         ,
    getSchemaName                           ,
#if defined(ENABLE_OVERLOADING)
    schema_name                             ,
#endif
    setSchemaName                           ,




    ) 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.BasicTypes as B.Types
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 Control.Monad.IO.Class as MIO
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.Secret.Flags as Secret.Flags

-- | Memory-managed wrapper type.
newtype Schema = Schema (SP.ManagedPtr Schema)
    deriving (Schema -> Schema -> Bool
(Schema -> Schema -> Bool)
-> (Schema -> Schema -> Bool) -> Eq Schema
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Schema -> Schema -> Bool
$c/= :: Schema -> Schema -> Bool
== :: Schema -> Schema -> Bool
$c== :: Schema -> Schema -> Bool
Eq)

instance SP.ManagedPtrNewtype Schema where
    toManagedPtr :: Schema -> ManagedPtr Schema
toManagedPtr (Schema ManagedPtr Schema
p) = ManagedPtr Schema
p

foreign import ccall "secret_schema_get_type" c_secret_schema_get_type :: 
    IO GType

type instance O.ParentTypes Schema = '[]
instance O.HasParentTypes Schema

instance B.Types.TypedObject Schema where
    glibType :: IO GType
glibType = IO GType
c_secret_schema_get_type

instance B.Types.GBoxed Schema

-- | Convert 'Schema' to and from 'Data.GI.Base.GValue.GValue' with 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue Schema where
    toGValue :: Schema -> IO GValue
toGValue Schema
o = do
        GType
gtype <- IO GType
c_secret_schema_get_type
        Schema -> (Ptr Schema -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Schema
o (GType -> (GValue -> Ptr Schema -> IO ()) -> Ptr Schema -> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr Schema -> IO ()
forall a. GValue -> Ptr a -> IO ()
B.GValue.set_boxed)
        
    fromGValue :: GValue -> IO Schema
fromGValue GValue
gv = do
        Ptr Schema
ptr <- GValue -> IO (Ptr Schema)
forall b. GValue -> IO (Ptr b)
B.GValue.get_boxed GValue
gv :: IO (Ptr Schema)
        (ManagedPtr Schema -> Schema) -> Ptr Schema -> IO Schema
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr Schema -> Schema
Schema Ptr Schema
ptr
        
    

-- | Construct a `Schema` struct initialized to zero.
newZeroSchema :: MonadIO m => m Schema
newZeroSchema :: m Schema
newZeroSchema = IO Schema -> m Schema
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Schema -> m Schema) -> IO Schema -> m Schema
forall a b. (a -> b) -> a -> b
$ Int -> IO (Ptr Schema)
forall a. GBoxed a => Int -> IO (Ptr a)
callocBoxedBytes Int
592 IO (Ptr Schema) -> (Ptr Schema -> IO Schema) -> IO Schema
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr Schema -> Schema) -> Ptr Schema -> IO Schema
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Schema -> Schema
Schema

instance tag ~ 'AttrSet => Constructible Schema tag where
    new :: (ManagedPtr Schema -> Schema) -> [AttrOp Schema tag] -> m Schema
new ManagedPtr Schema -> Schema
_ [AttrOp Schema tag]
attrs = do
        Schema
o <- m Schema
forall (m :: * -> *). MonadIO m => m Schema
newZeroSchema
        Schema -> [AttrOp Schema 'AttrSet] -> m ()
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set Schema
o [AttrOp Schema tag]
[AttrOp Schema 'AttrSet]
attrs
        Schema -> m Schema
forall (m :: * -> *) a. Monad m => a -> m a
return Schema
o


-- | Get the value of the “@name@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' schema #name
-- @
getSchemaName :: MonadIO m => Schema -> m (Maybe T.Text)
getSchemaName :: Schema -> m (Maybe Text)
getSchemaName Schema
s = IO (Maybe Text) -> m (Maybe Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ Schema -> (Ptr Schema -> IO (Maybe Text)) -> IO (Maybe Text)
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Schema
s ((Ptr Schema -> IO (Maybe Text)) -> IO (Maybe Text))
-> (Ptr Schema -> IO (Maybe Text)) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \Ptr Schema
ptr -> do
    CString
val <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek (Ptr Schema
ptr Ptr Schema -> Int -> Ptr CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) :: IO CString
    Maybe Text
result <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
SP.convertIfNonNull CString
val ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
val' -> do
        Text
val'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
val'
        Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
val''
    Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
result

-- | Set the value of the “@name@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' schema [ #name 'Data.GI.Base.Attributes.:=' value ]
-- @
setSchemaName :: MonadIO m => Schema -> CString -> m ()
setSchemaName :: Schema -> CString -> m ()
setSchemaName Schema
s CString
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ Schema -> (Ptr Schema -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Schema
s ((Ptr Schema -> IO ()) -> IO ()) -> (Ptr Schema -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Schema
ptr -> do
    Ptr CString -> CString -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Schema
ptr Ptr Schema -> Int -> Ptr CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) (CString
val :: CString)

-- | Set the value of the “@name@” 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' #name
-- @
clearSchemaName :: MonadIO m => Schema -> m ()
clearSchemaName :: Schema -> m ()
clearSchemaName Schema
s = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ Schema -> (Ptr Schema -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Schema
s ((Ptr Schema -> IO ()) -> IO ()) -> (Ptr Schema -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Schema
ptr -> do
    Ptr CString -> CString -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Schema
ptr Ptr Schema -> Int -> Ptr CString
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) (CString
forall a. Ptr a
FP.nullPtr :: CString)

#if defined(ENABLE_OVERLOADING)
data SchemaNameFieldInfo
instance AttrInfo SchemaNameFieldInfo where
    type AttrBaseTypeConstraint SchemaNameFieldInfo = (~) Schema
    type AttrAllowedOps SchemaNameFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint SchemaNameFieldInfo = (~) CString
    type AttrTransferTypeConstraint SchemaNameFieldInfo = (~)CString
    type AttrTransferType SchemaNameFieldInfo = CString
    type AttrGetType SchemaNameFieldInfo = Maybe T.Text
    type AttrLabel SchemaNameFieldInfo = "name"
    type AttrOrigin SchemaNameFieldInfo = Schema
    attrGet = getSchemaName
    attrSet = setSchemaName
    attrConstruct = undefined
    attrClear = clearSchemaName
    attrTransfer _ v = do
        return v

schema_name :: AttrLabelProxy "name"
schema_name = AttrLabelProxy

#endif


-- | Get the value of the “@flags@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' schema #flags
-- @
getSchemaFlags :: MonadIO m => Schema -> m [Secret.Flags.SchemaFlags]
getSchemaFlags :: Schema -> m [SchemaFlags]
getSchemaFlags Schema
s = IO [SchemaFlags] -> m [SchemaFlags]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [SchemaFlags] -> m [SchemaFlags])
-> IO [SchemaFlags] -> m [SchemaFlags]
forall a b. (a -> b) -> a -> b
$ Schema -> (Ptr Schema -> IO [SchemaFlags]) -> IO [SchemaFlags]
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Schema
s ((Ptr Schema -> IO [SchemaFlags]) -> IO [SchemaFlags])
-> (Ptr Schema -> IO [SchemaFlags]) -> IO [SchemaFlags]
forall a b. (a -> b) -> a -> b
$ \Ptr Schema
ptr -> do
    CUInt
val <- Ptr CUInt -> IO CUInt
forall a. Storable a => Ptr a -> IO a
peek (Ptr Schema
ptr Ptr Schema -> Int -> Ptr CUInt
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) :: IO CUInt
    let val' :: [SchemaFlags]
val' = CUInt -> [SchemaFlags]
forall a b. (Storable a, Integral a, Bits a, IsGFlag b) => a -> [b]
wordToGFlags CUInt
val
    [SchemaFlags] -> IO [SchemaFlags]
forall (m :: * -> *) a. Monad m => a -> m a
return [SchemaFlags]
val'

-- | Set the value of the “@flags@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' schema [ #flags 'Data.GI.Base.Attributes.:=' value ]
-- @
setSchemaFlags :: MonadIO m => Schema -> [Secret.Flags.SchemaFlags] -> m ()
setSchemaFlags :: Schema -> [SchemaFlags] -> m ()
setSchemaFlags Schema
s [SchemaFlags]
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ Schema -> (Ptr Schema -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Schema
s ((Ptr Schema -> IO ()) -> IO ()) -> (Ptr Schema -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Schema
ptr -> do
    let val' :: CUInt
val' = [SchemaFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [SchemaFlags]
val
    Ptr CUInt -> CUInt -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Schema
ptr Ptr Schema -> Int -> Ptr CUInt
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) (CUInt
val' :: CUInt)

#if defined(ENABLE_OVERLOADING)
data SchemaFlagsFieldInfo
instance AttrInfo SchemaFlagsFieldInfo where
    type AttrBaseTypeConstraint SchemaFlagsFieldInfo = (~) Schema
    type AttrAllowedOps SchemaFlagsFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint SchemaFlagsFieldInfo = (~) [Secret.Flags.SchemaFlags]
    type AttrTransferTypeConstraint SchemaFlagsFieldInfo = (~)[Secret.Flags.SchemaFlags]
    type AttrTransferType SchemaFlagsFieldInfo = [Secret.Flags.SchemaFlags]
    type AttrGetType SchemaFlagsFieldInfo = [Secret.Flags.SchemaFlags]
    type AttrLabel SchemaFlagsFieldInfo = "flags"
    type AttrOrigin SchemaFlagsFieldInfo = Schema
    attrGet = getSchemaFlags
    attrSet = setSchemaFlags
    attrConstruct = undefined
    attrClear = undefined
    attrTransfer _ v = do
        return v

schema_flags :: AttrLabelProxy "flags"
schema_flags = AttrLabelProxy

#endif


-- XXX Skipped attribute for "Schema:attributes"
-- Not implemented: Don't know how to unpack C array of type TCArray False 32 (-1) (TInterface (Name {namespace = "Secret", name = "SchemaAttribute"}))

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Schema
type instance O.AttributeList Schema = SchemaAttributeList
type SchemaAttributeList = ('[ '("name", SchemaNameFieldInfo), '("flags", SchemaFlagsFieldInfo)] :: [(Symbol, *)])
#endif

-- XXX Could not generate method Schema::new
-- Not implemented: GHashTable element of type TInterface (Name {namespace = "Secret", name = "SchemaAttributeType"}) unsupported.
-- method Schema::ref
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "schema"
--           , argType =
--               TInterface Name { namespace = "Secret" , name = "Schema" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the schema to reference"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Secret" , name = "Schema" })
-- throws : False
-- Skip return : False

foreign import ccall "secret_schema_ref" secret_schema_ref :: 
    Ptr Schema ->                           -- schema : TInterface (Name {namespace = "Secret", name = "Schema"})
    IO (Ptr Schema)

-- | Adds a reference to the t'GI.Secret.Structs.Schema.Schema'.
-- 
-- It is not normally necessary to call this function from C code, and is
-- mainly present for the sake of bindings. If the /@schema@/ was statically
-- allocated, then this function will copy the schema.
schemaRef ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Schema
    -- ^ /@schema@/: the schema to reference
    -> m Schema
    -- ^ __Returns:__ the referenced schema, which should be later
    --          unreferenced with 'GI.Secret.Structs.Schema.schemaUnref'
schemaRef :: Schema -> m Schema
schemaRef Schema
schema = IO Schema -> m Schema
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Schema -> m Schema) -> IO Schema -> m Schema
forall a b. (a -> b) -> a -> b
$ do
    Ptr Schema
schema' <- Schema -> IO (Ptr Schema)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Schema
schema
    Ptr Schema
result <- Ptr Schema -> IO (Ptr Schema)
secret_schema_ref Ptr Schema
schema'
    Text -> Ptr Schema -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"schemaRef" Ptr Schema
result
    Schema
result' <- ((ManagedPtr Schema -> Schema) -> Ptr Schema -> IO Schema
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Schema -> Schema
Schema) Ptr Schema
result
    Schema -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Schema
schema
    Schema -> IO Schema
forall (m :: * -> *) a. Monad m => a -> m a
return Schema
result'

#if defined(ENABLE_OVERLOADING)
data SchemaRefMethodInfo
instance (signature ~ (m Schema), MonadIO m) => O.MethodInfo SchemaRefMethodInfo Schema signature where
    overloadedMethod = schemaRef

#endif

-- method Schema::unref
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "schema"
--           , argType =
--               TInterface Name { namespace = "Secret" , name = "Schema" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the schema to reference"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "secret_schema_unref" secret_schema_unref :: 
    Ptr Schema ->                           -- schema : TInterface (Name {namespace = "Secret", name = "Schema"})
    IO ()

-- | Releases a reference to the t'GI.Secret.Structs.Schema.Schema'. If the last reference is
-- released then the schema will be freed.
-- 
-- It is not normally necessary to call this function from C code, and is
-- mainly present for the sake of bindings. It is an error to call this for
-- a /@schema@/ that was statically allocated.
schemaUnref ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Schema
    -- ^ /@schema@/: the schema to reference
    -> m ()
schemaUnref :: Schema -> m ()
schemaUnref Schema
schema = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Schema
schema' <- Schema -> IO (Ptr Schema)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Schema
schema
    Ptr Schema -> IO ()
secret_schema_unref Ptr Schema
schema'
    Schema -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Schema
schema
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data SchemaUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo SchemaUnrefMethodInfo Schema signature where
    overloadedMethod = schemaUnref

#endif

#if defined(ENABLE_OVERLOADING)
type family ResolveSchemaMethod (t :: Symbol) (o :: *) :: * where
    ResolveSchemaMethod "ref" o = SchemaRefMethodInfo
    ResolveSchemaMethod "unref" o = SchemaUnrefMethodInfo
    ResolveSchemaMethod l o = O.MethodResolutionFailed l o

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

#endif