AI4SAFE-IoT: an AI-powered secure architecture for edge layer of Internet of things