Help with template for light monitor

Hello, I need help with template code for new sensor in HA,
its little bit complicated but I need senor that write me 3 things
1 - Warning
2 - Serious warning
3 - OK

1 - Warning: if no motion detected for 30sec and if presence sensor detecting motion and if the boolean is on

2 - Serious warning: if no motion and no presence motion and boolean is on

3 - OK: else

Thank you !