local window = require('window')
local entity = require('entity')
local keypad = require('room/keypad')

local m = entity:from{
    width = 30,
    height = 40,
    lines = {
        {'fill', {0, 0, 0, 40, 30, 40, 30, 0}},
        {'fill', {5, 5, 25, 5, 25, 10, 5, 10}},
        {'fill', {5, 15, 25, 15, 25, 35, 5, 35}},
    },
    code = 45100,
}

local install = m.install
function m:install(room, x, y)
    self.keypad = keypad:from{
        code = self.code,
        oncorrect = self.oncorrect,
        room = room
    }

    install(self, room, x, y)
end

m.mousepressed = window.portal("keypad")

return m