You may have a defense to the sales or intent to distribute, but this of course depends on the factual circumstances. You need an attorney to read the police report and determine how best to create a defense for you.
Possession of ecstasy (which is considered a methampetamine) is a wobbler, meaning it can be charged as a misdemeanor or felony. With no prior record, you may have a shot at a misdemeanor, but again, this all depends on the court, the DA, and how strong or weak the prosecutors case is against you. In order to qualify for a misdemeanor possession and/or DEJ, the prosecutors would have to agree to dismiss the intent to sell/distribute, and instead charge you with a straight possession.
You need to hire an attorney who has experience with drug cases.
Possession of drugs for the purpose of sales is a felony. Deferred Entry of Judgment (PC1000) or Diversion (Prop 36) are not available for a person convicted of possession for sales. However, given the facts you posted, your attorney may be able to negotiate a plea to a lesser charge, such as possession for personal use as either a felony or misdemeanor, and then you'd be eligible for PC1000 or Prop 36. PC1000 is the better of the two since successful completion of the program will result in no criminal conviction on your record. You should consult with a defense attorney about obtaining the best possible result in your case.
To qualify for DEJ or misdemeanor the District Attorney would have to drop the "intent to sell" charge. That charge disqualifies you for DEJ. The facts of your case might permit this. Your lack of prior criminal record certainly helps. You need an attorney to get you through this process and review your matter.