---@meta lyaml

--------------------------------------------------------------------------------
-- LYAML module
--------------------------------------------------------------------------------

---@alias lyaml_scalar_parser fun(value:string):any

---@type lyaml_explicit*
local explicit = require("lyaml.explicit")

---@type lyaml_functional*
local functional = require("lyaml.functional")

---@type lyaml_implicit*
local implicit = require("lyaml.implicit")

---@type yaml*
local yaml_core = require("yaml")

---@class lyaml_dump_options*
---@field anchors? table<string,any> Initial anchor table, the key is the anchor name, the value is the Lua object that needs to be bound
---@field implicit_scalar? lyaml_scalar_parser Implicit scalar parser for determining whether a string requires an explicit quote

---@class lyaml_load_options*
---@field all? boolean Whether to return all documents
---@field explicit_scalar? table<string,lyaml_scalar_parser> Mapping of explicit tags to parsing functions
---@field implicit_scalar? lyaml_scalar_parser implicit scalar parser

---@class lyaml*
---@field null lyaml_null* YAML null Sentinel value
---@field _VERSION string yaml C Binding version information
---@type lyaml*
local M = {}

M.null = functional.NULL
M._VERSION = yaml_core.version

--- Dump a list of documents into a YAML stream.
---@param documents any[] Document list
---@param opts? lyaml_dump_options* Options
---@return string yaml YAML text
function M.dump(documents, opts) end

--- Load YAML stream as Lua value.
---@param s string YAML text
---@param opts? lyaml_load_options*|boolean Options; passing true is equivalent to `{ all = true }`
---@return any value Lua Value; returns a list of documents when opts.all is true
function M.load(s, opts) end

return M
