---@meta zlib

--------------------------------------------------------------------------------
-- lua-zlib C module
--------------------------------------------------------------------------------

---@alias zlib_flush 'none'|'sync'|'full'|'finish'
---@alias zlib_filter fun(input?:string, flush?:zlib_flush):string, boolean, integer, integer
---@alias zlib_checksum fun(input?:string|fun():integer, length?:integer):integer, integer

---@class zlib*
---@field BEST_SPEED integer Fastest compression level
---@field BEST_COMPRESSION integer Best compression level
---@field NO_COMPRESSION? integer No compression level
---@field DEFAULT_COMPRESSION? integer Default compression level
---@field FILTERED? integer filtered Strategy
---@field HUFFMAN_ONLY? integer huffman-only Strategy
---@field RLE? integer RLE Strategy
---@field FIXED? integer fixed Strategy
---@field DEFAULT_STRATEGY? integer Default policy
---@field MINIMUM_MEMLEVEL? integer Minimum memLevel
---@field MAXIMUM_MEMLEVEL? integer Maximum memLevel
---@field DEFAULT_MEMLEVEL? integer Default memLevel
---@field DEFAULT_WINDOWBITS? integer Default windowBits
---@field MINIMUM_WINDOWBITS? integer Minimum windowBits
---@field MAXIMUM_WINDOWBITS? integer Maximum windowBits
---@field GZIP_WINDOWBITS? integer gzip windowBits offset
---@field RAW_WINDOWBITS? integer raw windowBits mark
---@field _COPYRIGHT string Copyright information
---@field _DESCRIPTION string Module description
---@field _VERSION string module version
---@field _TEST_BUFSIZ integer Lua buffer size
---@type zlib*
local M = {}

--- Create deflate streaming compression function.
---@param level? integer Compression level
---@param windowBits? integer windowBits； Negative numbers can be used with raw deflate
---@return zlib_filter filter compression function
function M.deflate(level, windowBits) end

--- Create an inflate streaming decompression function.
---@param windowBits? integer windowBits； Automatically detect gzip/zlib headers by default
---@return zlib_filter filter decompression function
function M.inflate(windowBits) end

--- Create an Adler-32 checksum function.
---@return zlib_checksum checksum Check function
function M.adler32() end

--- Create a CRC-32 check function.
---@return zlib_checksum checksum Check function
function M.crc32() end

--- One-time compressed string; available when compiling with lzlib compatibility enabled.
---@param input string Enter data
---@param level? integer Compression level
---@param method? integer Compression method
---@param windowBits? integer windowBits
---@param memLevel? integer memLevel
---@param strategy? integer Compression strategy
---@return string? output Compress results
---@return integer code zlib return code
function M.compress(input, level, method, windowBits, memLevel, strategy) end

--- Decompress a string in one go; available when compiling with lzlib compatibility enabled.
---@param input string Enter data
---@param windowBits? integer windowBits
---@return string output Decompression results
function M.decompress(input, windowBits) end

--- Returns the underlying zlib version number component.
---@return integer major major version
---@return integer minor minor version
---@return integer patch Revision number
---@return integer? build Build number
function M.version() end

return M
