-- MosisService Lua Scripts
-- Button click handlers and UI logic

-- Counter to track button clicks
click_count = 0

-- Button click handler
function onButtonClick()
    click_count = click_count + 1
    print("Button clicked! Count: " .. click_count)

    -- Update the button text to show click count
    local document = rmlui.contexts["default"].documents[1]
    if document then
        local button = document:GetElementById("action-button")
        if button then
            button.inner_rml = "Clicked " .. click_count .. " times"
        end
    end
end

-- Reset counter function
function onResetClick()
    click_count = 0
    print("Counter reset!")

    local document = rmlui.contexts["default"].documents[1]
    if document then
        local button = document:GetElementById("action-button")
        if button then
            button.inner_rml = "Click Me!"
        end
    end
end

print("Lua scripts loaded successfully!")
