/*
 * Copyright (c) 2026 Huawei Technologies Co., Ltd.
 * openUBMC is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 *         http://license.coscl.org.cn/MulanPSL2
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 */

/*
 * lua_engine_stub.cpp — Zephyr-only 桩:Chip Lua 插件引擎(上游 480e0d5d "支持插件机制")
 *
 * chip_base 无条件持有 unique_ptr<lua_engine> 成员,即使
 * COMPONENT_DRIVERS_ENABLE_UNIDEV 未定义(插件调用路径被预处理掉),
 * ~chip_base() 仍引用 ~lua_engine()。真身 lua_engine.cpp 依赖 <lua.hpp>
 * 解释器(Linux 侧 conan 提供,Zephyr 无),故以本桩顶替所有 out-of-line
 * 公有符号:init 恒 false(chip.cpp 侧 call_once 内会转成
 * "lua engine init failed" 异常)、load_and_execute 恒 HAS_ERR。
 * 仅在真的对某 Chip 下发 Lua 插件命令时才会走到这些失败路径。
 */

#include "chip/chip_base/lua_engine.h"
#include "internal/hasdef.h"

namespace dev {

lua_engine::lua_engine()  = default;
lua_engine::~lua_engine() = default;

bool lua_engine::init(const std::string& /*plugin_base_path*/)
{
    return false;
}

int32_t lua_engine::load_and_execute(chip_base* /*chip*/, const std::string& /*plugin_name*/,
                                     const std::string& /*plugin_cmd*/, const std::vector<uint8_t>& /*params*/,
                                     std::vector<uint8_t>& /*out_buffer*/, std::string& error)
{
    error = "lua plugin engine is not available on Zephyr";
    return HAS_ERR;
}

void lua_engine::cleanup()
{}

} // namespace dev