utils = require("utils")

local currentTimeMs = 0

local mockPlaydate = {}

mockPlaydate = {
    TEST_MODE = true,
    skipMs = function(skip)
        currentTimeMs = currentTimeMs + skip
    end,
    getCurrentTimeMilliseconds = function()
        currentTimeMs = currentTimeMs + 1
        return currentTimeMs
    end,
    easingFunctions = {},
    timer = {
        lastTimer = {
            mockCompletion = function()
                error("No lastTimer set!")
            end,
        },
        new = function(_, callback)
            local timer = {
                mockCompletion = function()
                    callback()
                end,
            }
            mockPlaydate.timer.lastTimer = timer
            return timer
        end,
    },
    graphics = {
        animator = {
            new = function()
                return utils.staticAnimator(0)
            end,
        },
        animation = {
            blinker = {
                new = function()
                    return { start = function() end }
                end,
            },
        },
        font = {
            new = function()
                return {}
            end,
        },
        image = {
            new = function()
                return {}
            end,
        },
    },
    sound = {
        sampleplayer = {
            new = function()
                return {
                    play = function() end,
                    setFinishCallback = function() end,
                }
            end,
        },
    },
}

---@type Announcer
local mockAnnouncer = {
    say = function(self, message)
        self.lastMessage = message
    end,
}

return { mockPlaydate, mockAnnouncer }
