Let $n$ be an integer, there is a well-known formula for $\varphi(n)$ where $\varphi$ is the Euler phi function. Essentially, $\varphi(n)$ gives the number of invertible elements in $\mathbb{Z}/n\mathbb{Z}$. My questions are:
1) Since Dedekind domains have the same factorization theorem for ideals analogous to that of the integers, can one define a generalized Euler phi function type for an ideal of a Dedekind domain, i.e, $\varphi(I)$ shall give the number of invertible elements in $R/I$, and is there a nice formula for it? It makes sense to me that perhaps the formula should resemble that of the integer, using the factorization of $I$ into prime ideals. But I do not have a concrete idea of what it should be.
2) What about domains that are not Dedekind, more specifically, what are the minimum hypotheses that one can impose on a domain so that one can have perhaps a formula for Euler phi function type on the ideals? I am not sure if this even makes sense at this point.