Only experience I have had is a bit of knowledge handed to me after I was given a drug RX that was not allowed. Most people do not know this and they think otherwise, but I am here to tell ya all what can and will happen.
People think they are safe as long as they have a prescription. This is true with some drugs, but not the case for any drug listed on the FAA's list of prohibited drugs or meds while working live a/c or a/c parts. If anyone is drug tested, random or for issues, and they pop a positive for one of these drugs listed on the Faa's list you will be terminated. Not the co's call on this, it's the FAA's "absolute '0' tolerance policy". Now if someone would have one of the drugs in you from a prescription and it is not on the FAA's list of prohibited drugs list, and the numbers reflect the exact dosage given by a Dr. then they will be overlooked without termination, BUT, could still be counseled and or asked to stay off live a/c and parts until system is cleared. If an individual is ever asked to do so and they argue it, they still can be terminated if they refuse the co's wishes.
Sir, I have no clue the level and amount of codeine you had, however, if you had no prescript for it at the time you were under the influence of it, you may not have a leg to stand on with the "0" tolerance in aviation. However, I would contact the union, ask them to set a meeting for you and the co. and explain the mix up and basically beg for forgiveness to get your job back. I wish you luck sir. In my 30 years I have never seen anyone popped for drugs get their job back for any reason. The aviation "0" tolerance is exactly that, "0" tolerance.