The motte and bailey design was one type of medieval castle. Any type of castle that was built during the medieval period of history (which I would estimate as being roughly the year 400 AD to 1600 AD) qualifies as a medieval castle.
Meiveal castles were built for protection in wars to protect the people of the town e.g. Caernarfon Castle built in 1218. However castles built now have much less meaning and thought and are built purely for decerational matters