Tic-Tac-Toe AI

Can anyone explain to me the basics of creating an easy-medium-and hard level AI for tic tac toe? I cant figure it out…