{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- An opaque structure representing a test suite.

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

module GI.GLib.Structs.TestSuite
    ( 

-- * Exported types
    TestSuite(..)                           ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [add]("GI.GLib.Structs.TestSuite#g:method:add"), [addSuite]("GI.GLib.Structs.TestSuite#g:method:addSuite"), [free]("GI.GLib.Structs.TestSuite#g:method:free").
-- 
-- ==== Getters
-- /None/.
-- 
-- ==== Setters
-- /None/.

#if defined(ENABLE_OVERLOADING)
    ResolveTestSuiteMethod                  ,
#endif

-- ** add #method:add#

#if defined(ENABLE_OVERLOADING)
    TestSuiteAddMethodInfo                  ,
#endif
    testSuiteAdd                            ,


-- ** addSuite #method:addSuite#

#if defined(ENABLE_OVERLOADING)
    TestSuiteAddSuiteMethodInfo             ,
#endif
    testSuiteAddSuite                       ,


-- ** free #method:free#

#if defined(ENABLE_OVERLOADING)
    TestSuiteFreeMethodInfo                 ,
#endif
    testSuiteFree                           ,




    ) 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.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
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.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
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 qualified GHC.Records as R

import {-# SOURCE #-} qualified GI.GLib.Structs.TestCase as GLib.TestCase

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

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

-- XXX Wrapping a foreign struct/union with no known destructor or size, leak?
instance BoxedPtr TestSuite where
    boxedPtrCopy :: TestSuite -> IO TestSuite
boxedPtrCopy = TestSuite -> IO TestSuite
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return
    boxedPtrFree :: TestSuite -> IO ()
boxedPtrFree = \TestSuite
_x -> () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()


#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList TestSuite
type instance O.AttributeList TestSuite = TestSuiteAttributeList
type TestSuiteAttributeList = ('[ ] :: [(Symbol, DK.Type)])
#endif

-- method TestSuite::add
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "suite"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "TestSuite" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GTestSuite" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "test_case"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "TestCase" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GTestCase" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_test_suite_add" g_test_suite_add :: 
    Ptr TestSuite ->                        -- suite : TInterface (Name {namespace = "GLib", name = "TestSuite"})
    Ptr GLib.TestCase.TestCase ->           -- test_case : TInterface (Name {namespace = "GLib", name = "TestCase"})
    IO ()

-- | Adds /@testCase@/ to /@suite@/.
-- 
-- /Since: 2.16/
testSuiteAdd ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    TestSuite
    -- ^ /@suite@/: a t'GI.GLib.Structs.TestSuite.TestSuite'
    -> GLib.TestCase.TestCase
    -- ^ /@testCase@/: a t'GI.GLib.Structs.TestCase.TestCase'
    -> m ()
testSuiteAdd :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
TestSuite -> TestCase -> m ()
testSuiteAdd TestSuite
suite TestCase
testCase = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr TestSuite
suite' <- TestSuite -> IO (Ptr TestSuite)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr TestSuite
suite
    Ptr TestCase
testCase' <- TestCase -> IO (Ptr TestCase)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr TestCase
testCase
    Ptr TestSuite -> Ptr TestCase -> IO ()
g_test_suite_add Ptr TestSuite
suite' Ptr TestCase
testCase'
    TestSuite -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr TestSuite
suite
    TestCase -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr TestCase
testCase
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data TestSuiteAddMethodInfo
instance (signature ~ (GLib.TestCase.TestCase -> m ()), MonadIO m) => O.OverloadedMethod TestSuiteAddMethodInfo TestSuite signature where
    overloadedMethod = testSuiteAdd

instance O.OverloadedMethodInfo TestSuiteAddMethodInfo TestSuite where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.GLib.Structs.TestSuite.testSuiteAdd",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.29/docs/GI-GLib-Structs-TestSuite.html#v:testSuiteAdd"
        })


#endif

-- method TestSuite::add_suite
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "suite"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "TestSuite" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GTestSuite" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "nestedsuite"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "TestSuite" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "another #GTestSuite"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_test_suite_add_suite" g_test_suite_add_suite :: 
    Ptr TestSuite ->                        -- suite : TInterface (Name {namespace = "GLib", name = "TestSuite"})
    Ptr TestSuite ->                        -- nestedsuite : TInterface (Name {namespace = "GLib", name = "TestSuite"})
    IO ()

-- | Adds /@nestedsuite@/ to /@suite@/.
-- 
-- /Since: 2.16/
testSuiteAddSuite ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    TestSuite
    -- ^ /@suite@/: a t'GI.GLib.Structs.TestSuite.TestSuite'
    -> TestSuite
    -- ^ /@nestedsuite@/: another t'GI.GLib.Structs.TestSuite.TestSuite'
    -> m ()
testSuiteAddSuite :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
TestSuite -> TestSuite -> m ()
testSuiteAddSuite TestSuite
suite TestSuite
nestedsuite = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr TestSuite
suite' <- TestSuite -> IO (Ptr TestSuite)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr TestSuite
suite
    Ptr TestSuite
nestedsuite' <- TestSuite -> IO (Ptr TestSuite)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr TestSuite
nestedsuite
    Ptr TestSuite -> Ptr TestSuite -> IO ()
g_test_suite_add_suite Ptr TestSuite
suite' Ptr TestSuite
nestedsuite'
    TestSuite -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr TestSuite
suite
    TestSuite -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr TestSuite
nestedsuite
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data TestSuiteAddSuiteMethodInfo
instance (signature ~ (TestSuite -> m ()), MonadIO m) => O.OverloadedMethod TestSuiteAddSuiteMethodInfo TestSuite signature where
    overloadedMethod = testSuiteAddSuite

instance O.OverloadedMethodInfo TestSuiteAddSuiteMethodInfo TestSuite where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.GLib.Structs.TestSuite.testSuiteAddSuite",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.29/docs/GI-GLib-Structs-TestSuite.html#v:testSuiteAddSuite"
        })


#endif

-- method TestSuite::free
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "suite"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "TestSuite" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GTestSuite" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_test_suite_free" g_test_suite_free :: 
    Ptr TestSuite ->                        -- suite : TInterface (Name {namespace = "GLib", name = "TestSuite"})
    IO ()

-- | Free the /@suite@/ and all nested @/GTestSuites/@.
-- 
-- /Since: 2.70/
testSuiteFree ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    TestSuite
    -- ^ /@suite@/: a t'GI.GLib.Structs.TestSuite.TestSuite'
    -> m ()
testSuiteFree :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
TestSuite -> m ()
testSuiteFree TestSuite
suite = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr TestSuite
suite' <- TestSuite -> IO (Ptr TestSuite)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr TestSuite
suite
    Ptr TestSuite -> IO ()
g_test_suite_free Ptr TestSuite
suite'
    TestSuite -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr TestSuite
suite
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data TestSuiteFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.OverloadedMethod TestSuiteFreeMethodInfo TestSuite signature where
    overloadedMethod = testSuiteFree

instance O.OverloadedMethodInfo TestSuiteFreeMethodInfo TestSuite where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.GLib.Structs.TestSuite.testSuiteFree",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.29/docs/GI-GLib-Structs-TestSuite.html#v:testSuiteFree"
        })


#endif

#if defined(ENABLE_OVERLOADING)
type family ResolveTestSuiteMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
    ResolveTestSuiteMethod "add" o = TestSuiteAddMethodInfo
    ResolveTestSuiteMethod "addSuite" o = TestSuiteAddSuiteMethodInfo
    ResolveTestSuiteMethod "free" o = TestSuiteFreeMethodInfo
    ResolveTestSuiteMethod l o = O.MethodResolutionFailed l o

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

#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveTestSuiteMethod t TestSuite, O.OverloadedMethod info TestSuite p, R.HasField t TestSuite p) => R.HasField t TestSuite p where
    getField = O.overloadedMethod @info

#endif

instance (info ~ ResolveTestSuiteMethod t TestSuite, O.OverloadedMethodInfo info TestSuite) => OL.IsLabel t (O.MethodProxy info TestSuite) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.MethodProxy
#else
    fromLabel _ = O.MethodProxy
#endif

#endif