How to make enemy Ai Chase the player through a state change.

This may sound a bit complicated but I can further elaborate if need be.
I am trying to create an Enemy Ai that chases the player, the catch is it needs to be through a state change via components that switches the enemy’s state, for example, once the enemy sees the player, the state will change to anger, once angered, chase the player; when the enemy loses sight for x amount of time, exit state back to patrol


these images represent what I have so far . the ai is able to change state, as the color changes to purple but they remain stationary