local ls = require("luasnip")
local s = ls.snippet
local t = ls.text_node
local i = ls.insert_node
local f = ls.function_node
local extras = require("luasnip.extras")
local rep = extras.rep
local timestamp = function()
  return tostring(os.time())
end

local get_date = function()
  return os.date("%H:%M:%S %d.%m.%Y")
end

local get_name = function()
  return "Nikolai Papin"
end

return {
  -- Creates a frontmatter with markdown note metadata
  s("frontmatter", {
    t("---"),
    t({ "", "Markdown note", "" }),
    t({ "", "title: \"" }), i(8), t("\""),
    t({ "", "date: \"" }), f(get_date, {}), t("\""),
    t({ "", "author: \"" }), f(get_name, {}), t("\""),
    t({ "", "keywords: ["}), i(6), t("]"),
    t({ "", "tags: [["}), i(7), t("]]"),
    t({ "", "id: " }), f(timestamp, {}),
    t({ "", "" }),
    t({ "", "sleep: " }), i(1), t("/5"),
    t({ "", "emotions: [" }), i(2), t("]"),
    t({ "", "comfort: " }), i(3), t("/5"),
    t({ "", "complaints: ["}), i(4), t("]"),
    t({ "", "mood: " }), i(5), t("/10"),

    t({ "", "---", "", "# " }),
    rep(8),  -- Reuses the first insert node
    t({ "", ""}),
    t({ "", ""}),
    i(9)     -- Final cursor position
  }),
}
