Repeat send emails based on behaviour

I'm trying to integrate my shopping cart to MailWizz to do the following:

1. When customer purchases Product1 I subscribe him to my list and send him Email1.
2. 30 days after purchasing Product1, if he didn't purchase Product2, I send him Email2.
3. If the same customer purchases again Product1, I still want to send the Email2 of the first purchase, and again Email2 for the second purchase.

My shopping cart can send API calls to modify the subscriber as needed, but I didn't manage to find a way to do it: tried moving subscriber to multiple lists, with different custom fields and segments, but it wouldn't work for point 3.

Any ideas how to make this work?
I am not sure why this is complicated, maybe i see it otherwise, but i would have a list where i would send these subscribers via mailwizz api.
This list will also have various autoresponders on various intervals as you wish.
Now, when you add the customer in a list as a subscriber, the AR will start send for that subscriber. If you want AR's to stop sending for him, you just unsubscribe the subscriber.
Maybe i over simplified, but it should be that simple.
Please note that moving subscribers is almost always not the right choice.
The problem is that when the subscriber purchases Product1 and I subscribe him to List1 (which has the autoresponder campaigns to receive Email1 and Email2), if he purchases Product1 again, it will fail because he is in the list already.
Yes because even if I move it to a second list, the second time around will fail because the subscriber is already in the second list.
Gotcha, i'm kinda out of ideas for this. To be honest the workflow looks complicated to me.
Ok this is what I came up with:

I'd create a new autoresponder event that reads a subscriber custom field that holds a json string containing flags with dates when the campaign should be sent. For example: ["flag_name1": "2016-1-4T1:59:59", "flag_name2": "2016-1-4T2:59:59"]. The autoresponder would loop this values and if any date is lower than now, it will send the email, and remove the flag-date pair from the custom field.

I think this will be very flexible, because you can set the email to be sent in the future as many times as you want, and you will also be able to remove scheduled emails if you need to. For example in my case I could remove "order_number001": "2016-1-4T1:59:59" if he purchases Product2 before 30 days.

For even more usefulness, I'd add a "data" property, that holds values that can be replaced in the email template. For example ["order_number001": {"date": "2016-1-4T1:59:59", "data": {"ORDER_ID": "001", "ORDER_AMOUNT": "$10"}]. Then in the template I could get [ORDER_ID] replaced with 001 and so on.

This feature would open up MailWizz to a whole new level of use cases, and pair it with advanced marketing automation apps like InfusionSoft and the likes.

Do you think this will be interesting to add to a future release?
It sounds interesting. Not sure about the json parsing as you can't really set preconditions into a sql query against the json field in mysql(i know with postgresql you can query json blobs) and thus you'd end up loading lots of data and then parse it and discard whatever is not needed, then same process all over again.
Need to thing more about this :)
Yeah the initial idea for simplicity reasons would require an extra query to extract the json data for each list subscriber in the SEND_FLAG autoresponder campaign, so it adds to the queue only the necessary emails. However I do agree that might compromise performance. Although it seems that there are ways to parse json directly from the query, the ideal would be to do it via a relational table. Maybe adding a special custom field called Send Flags, and then adding add/remove flag functionality in subscriber frontend and API calls. That'd make even easier the flag manipulation.