We build a general model for pricing defaultable claims. In addition to the usual absence of arbitrage assumption, we assume that one defaultable asset (at least) looses value when the default occurs. We prove that under this assumption, in some standard market filtrations, default times are totally inaccessible stopping times; we therefore proceed to a systematic construction of default times with particular emphasis on totally inaccessible stopping times. Surprisingly, this abstract mathematical construction, reveals a very specific and useful way in which default models can be built, using both market factors and idiosyncratic factors. We then provide all the relevant characteristics of a default time (i.e. the Az\'ema supermartingale and its Doob-Meyer decomposition) given the information about these factors. We also provide explicit formulas for the prices of defaultable claims and analyze the risk premiums that form in the market in anticipation of losses which occur at the default event. The usual reduced-form framework is extended in order to include possible economic shocks, in particular jumps of the recovery process at the default time. This formulas are not classic and we point out that the knowledge of the default compensator or the intensity process is not anymore a sufficient quantity for finding explicit prices, but we need indeed the Az\'ema supermartingale and its Doob-Meyer decomposition.