shouldn't have called it a room
That's not a bedroom. It's a bunk. It's not illegal to have a bed in a room. It's not illegal for that bed to be an enclosed bunk. When you say it's a structure rather than furniture you're inviting building codes into the conversation.