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

    Zlib decompression
    -}

    #define ENABLE_OVERLOADING \
           (!defined(__HADDOCK_VERSION__))

    module GI.Gio.Objects.ZlibDecompressor
        (

    -- * Exported types
        ZlibDecompressor(..)                    ,
        IsZlibDecompressor                      ,
        toZlibDecompressor                      ,
        noZlibDecompressor                      ,

     -- * Methods
    -- ** getFileInfo #method:getFileInfo#

    #if ENABLE_OVERLOADING
        ZlibDecompressorGetFileInfoMethodInfo   ,
    #endif
        zlibDecompressorGetFileInfo             ,

    -- ** new #method:new#

        zlibDecompressorNew                     ,

     -- * Properties
    -- ** fileInfo #attr:fileInfo#
    {- | A 'GI.Gio.Objects.FileInfo.FileInfo' containing the information found in the GZIP header
    of the data stream processed, or 'Nothing' if the header was not yet
    fully processed, is not present at all, or the compressor\'s
    'GI.Gio.Objects.ZlibDecompressor.ZlibDecompressor':@/format/@ property is not 'GI.Gio.Enums.ZlibCompressorFormatGzip'.

    /Since: 2.26/
    -}
    #if ENABLE_OVERLOADING
        ZlibDecompressorFileInfoPropertyInfo    ,
    #endif
        getZlibDecompressorFileInfo             ,
    #if ENABLE_OVERLOADING
        zlibDecompressorFileInfo                ,
    #endif

    -- ** format #attr:format#
    {- | /No description available in the introspection data./
    -}
    #if ENABLE_OVERLOADING
        ZlibDecompressorFormatPropertyInfo      ,
    #endif
        constructZlibDecompressorFormat         ,
        getZlibDecompressorFormat               ,
    #if ENABLE_OVERLOADING
        zlibDecompressorFormat                  ,
    #endif

        ) 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.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.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.GObject.Objects.Object as GObject.Object
    import {-# SOURCE #-} qualified GI.Gio.Enums as Gio.Enums
    import {-# SOURCE #-} qualified GI.Gio.Interfaces.Converter as Gio.Converter
    import {-# SOURCE #-} qualified GI.Gio.Objects.FileInfo as Gio.FileInfo

    -- | Memory-managed wrapper type.
    newtype ZlibDecompressor = ZlibDecompressor (ManagedPtr ZlibDecompressor)
    foreign import ccall "g_zlib_decompressor_get_type"
        c_g_zlib_decompressor_get_type :: IO GType

    instance GObject ZlibDecompressor where
        gobjectType _ = c_g_zlib_decompressor_get_type

    -- | Type class for types which can be safely cast to `ZlibDecompressor`, for instance with `toZlibDecompressor`.
    class GObject o => IsZlibDecompressor o
    #if MIN_VERSION_base(4,9,0)
    instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError ZlibDecompressor a) =>
        IsZlibDecompressor a
    #endif
    instance IsZlibDecompressor ZlibDecompressor
    instance GObject.Object.IsObject ZlibDecompressor
    instance Gio.Converter.IsConverter ZlibDecompressor

    -- | Cast to `ZlibDecompressor`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
    toZlibDecompressor :: (MonadIO m, IsZlibDecompressor o) => o -> m ZlibDecompressor
    toZlibDecompressor = liftIO . unsafeCastTo ZlibDecompressor

    -- | A convenience alias for `Nothing` :: `Maybe` `ZlibDecompressor`.
    noZlibDecompressor :: Maybe ZlibDecompressor
    noZlibDecompressor = Nothing

    #if ENABLE_OVERLOADING
    type family ResolveZlibDecompressorMethod (t :: Symbol) (o :: *) :: * where
        ResolveZlibDecompressorMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
        ResolveZlibDecompressorMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
        ResolveZlibDecompressorMethod "convert" o = Gio.Converter.ConverterConvertMethodInfo
        ResolveZlibDecompressorMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
        ResolveZlibDecompressorMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
        ResolveZlibDecompressorMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
        ResolveZlibDecompressorMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
        ResolveZlibDecompressorMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
        ResolveZlibDecompressorMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
        ResolveZlibDecompressorMethod "ref" o = GObject.Object.ObjectRefMethodInfo
        ResolveZlibDecompressorMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
        ResolveZlibDecompressorMethod "reset" o = Gio.Converter.ConverterResetMethodInfo
        ResolveZlibDecompressorMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
        ResolveZlibDecompressorMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
        ResolveZlibDecompressorMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
        ResolveZlibDecompressorMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
        ResolveZlibDecompressorMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
        ResolveZlibDecompressorMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
        ResolveZlibDecompressorMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
        ResolveZlibDecompressorMethod "getFileInfo" o = ZlibDecompressorGetFileInfoMethodInfo
        ResolveZlibDecompressorMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
        ResolveZlibDecompressorMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
        ResolveZlibDecompressorMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
        ResolveZlibDecompressorMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
        ResolveZlibDecompressorMethod l o = O.MethodResolutionFailed l o

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

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

    #endif

    -- VVV Prop "file-info"
       -- Type: TInterface (Name {namespace = "Gio", name = "FileInfo"})
       -- Flags: [PropertyReadable]
       -- Nullable: (Just False,Nothing)

    {- |
    Get the value of the “@file-info@” property.
    When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

    @
    'Data.GI.Base.Attributes.get' zlibDecompressor #fileInfo
    @
    -}
    getZlibDecompressorFileInfo :: (MonadIO m, IsZlibDecompressor o) => o -> m Gio.FileInfo.FileInfo
    getZlibDecompressorFileInfo obj = liftIO $ checkUnexpectedNothing "getZlibDecompressorFileInfo" $ getObjectPropertyObject obj "file-info" Gio.FileInfo.FileInfo

    #if ENABLE_OVERLOADING
    data ZlibDecompressorFileInfoPropertyInfo
    instance AttrInfo ZlibDecompressorFileInfoPropertyInfo where
        type AttrAllowedOps ZlibDecompressorFileInfoPropertyInfo = '[ 'AttrGet, 'AttrClear]
        type AttrSetTypeConstraint ZlibDecompressorFileInfoPropertyInfo = (~) ()
        type AttrBaseTypeConstraint ZlibDecompressorFileInfoPropertyInfo = IsZlibDecompressor
        type AttrGetType ZlibDecompressorFileInfoPropertyInfo = Gio.FileInfo.FileInfo
        type AttrLabel ZlibDecompressorFileInfoPropertyInfo = "file-info"
        type AttrOrigin ZlibDecompressorFileInfoPropertyInfo = ZlibDecompressor
        attrGet _ = getZlibDecompressorFileInfo
        attrSet _ = undefined
        attrConstruct _ = undefined
        attrClear _ = undefined
    #endif

    -- VVV Prop "format"
       -- Type: TInterface (Name {namespace = "Gio", name = "ZlibCompressorFormat"})
       -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
       -- Nullable: (Nothing,Nothing)

    {- |
    Get the value of the “@format@” property.
    When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

    @
    'Data.GI.Base.Attributes.get' zlibDecompressor #format
    @
    -}
    getZlibDecompressorFormat :: (MonadIO m, IsZlibDecompressor o) => o -> m Gio.Enums.ZlibCompressorFormat
    getZlibDecompressorFormat obj = liftIO $ getObjectPropertyEnum obj "format"

    {- |
    Construct a `GValueConstruct` with valid value for the “@format@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
    -}
    constructZlibDecompressorFormat :: (IsZlibDecompressor o) => Gio.Enums.ZlibCompressorFormat -> IO (GValueConstruct o)
    constructZlibDecompressorFormat val = constructObjectPropertyEnum "format" val

    #if ENABLE_OVERLOADING
    data ZlibDecompressorFormatPropertyInfo
    instance AttrInfo ZlibDecompressorFormatPropertyInfo where
        type AttrAllowedOps ZlibDecompressorFormatPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
        type AttrSetTypeConstraint ZlibDecompressorFormatPropertyInfo = (~) Gio.Enums.ZlibCompressorFormat
        type AttrBaseTypeConstraint ZlibDecompressorFormatPropertyInfo = IsZlibDecompressor
        type AttrGetType ZlibDecompressorFormatPropertyInfo = Gio.Enums.ZlibCompressorFormat
        type AttrLabel ZlibDecompressorFormatPropertyInfo = "format"
        type AttrOrigin ZlibDecompressorFormatPropertyInfo = ZlibDecompressor
        attrGet _ = getZlibDecompressorFormat
        attrSet _ = undefined
        attrConstruct _ = constructZlibDecompressorFormat
        attrClear _ = undefined
    #endif

    #if ENABLE_OVERLOADING
    instance O.HasAttributeList ZlibDecompressor
    type instance O.AttributeList ZlibDecompressor = ZlibDecompressorAttributeList
    type ZlibDecompressorAttributeList = ('[ '("fileInfo", ZlibDecompressorFileInfoPropertyInfo), '("format", ZlibDecompressorFormatPropertyInfo)] :: [(Symbol, *)])
    #endif

    #if ENABLE_OVERLOADING
    zlibDecompressorFileInfo :: AttrLabelProxy "fileInfo"
    zlibDecompressorFileInfo = AttrLabelProxy

    zlibDecompressorFormat :: AttrLabelProxy "format"
    zlibDecompressorFormat = AttrLabelProxy

    #endif

    #if ENABLE_OVERLOADING
    type instance O.SignalList ZlibDecompressor = ZlibDecompressorSignalList
    type ZlibDecompressorSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

    #endif

    -- method ZlibDecompressor::new
    -- method type : Constructor
    -- Args : [Arg {argCName = "format", argType = TInterface (Name {namespace = "Gio", name = "ZlibCompressorFormat"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The format to use for the compressed data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
    -- Lengths : []
    -- returnType : Just (TInterface (Name {namespace = "Gio", name = "ZlibDecompressor"}))
    -- throws : False
    -- Skip return : False

    foreign import ccall "g_zlib_decompressor_new" g_zlib_decompressor_new ::
        CUInt ->                                -- format : TInterface (Name {namespace = "Gio", name = "ZlibCompressorFormat"})
        IO (Ptr ZlibDecompressor)

    {- |
    Creates a new 'GI.Gio.Objects.ZlibDecompressor.ZlibDecompressor'.

    /Since: 2.24/
    -}
    zlibDecompressorNew ::
        (B.CallStack.HasCallStack, MonadIO m) =>
        Gio.Enums.ZlibCompressorFormat
        {- ^ /@format@/: The format to use for the compressed data -}
        -> m ZlibDecompressor
        {- ^ __Returns:__ a new 'GI.Gio.Objects.ZlibDecompressor.ZlibDecompressor' -}
    zlibDecompressorNew format = liftIO $ do
        let format' = (fromIntegral . fromEnum) format
        result <- g_zlib_decompressor_new format'
        checkUnexpectedReturnNULL "zlibDecompressorNew" result
        result' <- (wrapObject ZlibDecompressor) result
        return result'

    #if ENABLE_OVERLOADING
    #endif

    -- method ZlibDecompressor::get_file_info
    -- method type : OrdinaryMethod
    -- Args : [Arg {argCName = "decompressor", argType = TInterface (Name {namespace = "Gio", name = "ZlibDecompressor"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GZlibDecompressor", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
    -- Lengths : []
    -- returnType : Just (TInterface (Name {namespace = "Gio", name = "FileInfo"}))
    -- throws : False
    -- Skip return : False

    foreign import ccall "g_zlib_decompressor_get_file_info" g_zlib_decompressor_get_file_info ::
        Ptr ZlibDecompressor ->                 -- decompressor : TInterface (Name {namespace = "Gio", name = "ZlibDecompressor"})
        IO (Ptr Gio.FileInfo.FileInfo)

    {- |
    Retrieves the 'GI.Gio.Objects.FileInfo.FileInfo' constructed from the GZIP header data
    of compressed data processed by /@compressor@/, or 'Nothing' if /@decompressor@/\'s
    'GI.Gio.Objects.ZlibDecompressor.ZlibDecompressor':@/format/@ property is not 'GI.Gio.Enums.ZlibCompressorFormatGzip',
    or the header data was not fully processed yet, or it not present in the
    data stream at all.

    /Since: 2.26/
    -}
    zlibDecompressorGetFileInfo ::
        (B.CallStack.HasCallStack, MonadIO m, IsZlibDecompressor a) =>
        a
        {- ^ /@decompressor@/: a 'GI.Gio.Objects.ZlibDecompressor.ZlibDecompressor' -}
        -> m Gio.FileInfo.FileInfo
        {- ^ __Returns:__ a 'GI.Gio.Objects.FileInfo.FileInfo', or 'Nothing' -}
    zlibDecompressorGetFileInfo decompressor = liftIO $ do
        decompressor' <- unsafeManagedPtrCastPtr decompressor
        result <- g_zlib_decompressor_get_file_info decompressor'
        checkUnexpectedReturnNULL "zlibDecompressorGetFileInfo" result
        result' <- (newObject Gio.FileInfo.FileInfo) result
        touchManagedPtr decompressor
        return result'

    #if ENABLE_OVERLOADING
    data ZlibDecompressorGetFileInfoMethodInfo
    instance (signature ~ (m Gio.FileInfo.FileInfo), MonadIO m, IsZlibDecompressor a) => O.MethodInfo ZlibDecompressorGetFileInfoMethodInfo a signature where
        overloadedMethod _ = zlibDecompressorGetFileInfo

    #endif