I am trying to make a system for selling acai berry. In an açaí can add many ingredients like paçoca, milk powder, fruits and etc ... Açaí can also be sold in pots of 250ml, 500ml and 750ml. Depending on which pot is sold, an N amount will be removed from the stock. The same applies to the added ingredients. It is worth remembering that the establishment also sells bottles of water, juices, soft drinks, which do not cease to be products!
Anyway, I'm trying to make the template, and until then I find myself like this:
I'vesetanIngredientandaProducttobeatypeofItem,sincetheyhavestock,haveapriceingredientwilladdtothefinalpriceoftheproduct),sotheyinheritfromtheabstractItemclass.TheIngredientclasshasalistofcategoriesthatcanbeadded,forexample:MilkpowdercanbeaddedintheAcaicategory,butneverintheRefrigerantcategory.
Iwanttoknowifthemodelisgood,Ithoughtaboutusingthedecoratorpattern,butIdonotknowifIwillhaveproblemsinsertingintothedatabase.IwilluseC#andFluentNhibernatewithMySQL.Anyway,howtosolvethe250ml/750mlpotproblem?Andthefactthatnotallingredientsarecompatiblewithallproducts,didItakeagoodapproachtotheproblem?
Iacceptsuggestionsonanypartofthetemplatetotrytosolvetheproblem,aslongastherearenoproblemstowritetothedatabase(whichisalsosubjecttochange).
EDITFollowingadvice,Ichangedthediagramandthisoneissonow: Solved the problem of a product may come to spend X inputs. But I am now in the following situation. If my client buys a bottle of water from a supplier, he sells the whole water bottle without spending any input, the bottle is the stock itself, how to solve it? I thought about creating a stock class, but how could I connect to the Stock Input and Product at the same time?