---@meta iconv

--------------------------------------------------------------------------------
-- luaiconv C module
--------------------------------------------------------------------------------

---@alias iconv_error integer

---@class iconv_converter*
local iconv_converter = {}

--- Convert string encoding.
---@param input string Enter text
---@return string output Converted text; on error, converted prefix
---@return iconv_error? errCode error code
function iconv_converter:iconv(input) end

---@class iconv*
---@field ERROR_NO_MEMORY integer Out of memory
---@field ERROR_INVALID integer Illegal byte sequence
---@field ERROR_INCOMPLETE integer Incomplete byte sequence
---@field ERROR_FINALIZED integer Converter released
---@field ERROR_UNKNOWN integer unknown error
---@field VERSION string version
---@type iconv*
local M = {}

--- Create a transcoder.
---@param tocode string target encoding
---@param fromcode string Source encoding
---@return iconv_converter*? converter converter; nil on failure
function M.open(tocode, fromcode) end

--- Create a transcoder.
---@param tocode string target encoding
---@param fromcode string Source encoding
---@return iconv_converter*? converter converter; nil on failure
function M.new(tocode, fromcode) end

--- Convert the string using a converter.
---@param converter iconv_converter* converter
---@param input string Enter text
---@return string output Converted text; on error, converted prefix
---@return iconv_error? errCode error code
function M.iconv(converter, input) end

--- Lists the encoding names currently supported by iconv.
---@return string[] names encoding name list
function M.list() end

return M
