There isn't anything written up with that kind of detail. Once you get into that level of complexity it involves custom coding with php.
You would probably store the coupon details in a database table and loop through the cart calculating discounted prices on the shopping cart page, the looping and discounting would have to be done by hand with php.