Need help with a simple occupancy sensor

I want to make a simple occupancy sensor using two PIRs, by having a counter (inside the code) that increases by 1 when PIR1 detects motion before PIR2, and decreases by 1 when PIR2 detects motion before PIR1. So that whenever the counter is above zero (indicating the number of people in the room) the lights turn on, and when everyone gets out i.e. the counter becomes 0, the lights turn off.
However, I wanted to test this using a LED before wiring the device to the room lights, as shown in the following image:

My problem now is with the code, I can't figure something out that satisfies these requirements, it's very essential for this to work is that the Arduino differentiates between which PIR gives an input before the other.
I know that this solution for an occupancy sensor may not be very practical, but I want to make the most out of these two PIRs only.
I only need help with the code, however if you have a better idea for a simple occupancy sensor, please be my guest.

Arduino: Uno.

We have occupency sensors in all of our rooms at our office. the ones over the main open floor plan are meshed together and the ones in the restrooms and small meeting rooms are separate.

The rules are as follows.

  1. the small rooms are set so that it detects every minute and if it sees anything to stay on for 5,10 or 30 minutes.

  2. the main area is hooked up to 30 lights that are in zones, we don't want to turn off any of the lights in any of the zones if someone is in the area. and it uses the same rules as the small office, but since they are meshed together, if one zone senses movement, then the other zones stay active.

  1. You need a current limiting resistor for the LED say 220 or 330 ohm.

  2. You need to look at this code example, then you need to set up some flags, so that you can store which was activated first.