use mlua::{FromLua, IntoLua, Lua, LuaSerdeExt, Value};
use serde::{Deserialize, Serialize};
use yazi_shim::{SStr, mlua::SER_OPT};

#[derive(Debug, Default, Deserialize, Serialize)]
pub struct TitleForm {
	pub value: Option<SStr>,
}

impl FromLua for TitleForm {
	fn from_lua(value: Value, lua: &Lua) -> mlua::Result<Self> { lua.from_value(value) }
}

impl IntoLua for TitleForm {
	fn into_lua(self, lua: &Lua) -> mlua::Result<Value> { lua.to_value_with(&self, SER_OPT) }
}
