Let $K$ be a quadratic number field. Let $R$ be an order of $K$, i.e. a subring of $K$ which is a free $\mathbb{Z}$-module of rank $2$. Let $D$ be the discriminant of $R$. Let $x_1,\cdots, x_n$ be a sequence of elements of $R$. We denote by $[x_1,\cdots,x_n]$ the $\mathbb{Z}$-submodule of $R$ generated by $x_1,\cdots, x_n$. By this question, $R = [1, \omega]$, where $\omega = \frac{(D + \sqrt D)}{2}$. Let $I$ be an ideal of $R$. If there exists an $R$-submodule $J$ of $K$ such that $IJ = R$, $I$ is called invertible. It is easy to see that $J$ is uniquely determined by $I$. It is also easy to see that $J$ is a $\mathbb{Z}$-free submodule of $K$ of rank $2$. $J$ is denoted by $I^{-1}$.
I would like to determine whether a given non-zero ideal $I$ of $R$ is invertible or not. By this question, there exist unique rational integers $a, b, c$ such that $I = [a, b + c\omega], a \gt 0, c \gt 0, 0 \le b \lt a, a \equiv 0$ (mod $c$), $b \equiv 0$ (mod $c$). If $c = 1$, we say $I$ is a primitive ideal. Let $a = ca'$, $b = cb'$. Then $I = cJ$, where $J = [a', b' + \omega]$. Clearly $J$ is a primitive ideal. $I$ is invertible if and only if $J$ is invertible. Hence we can assume that $I$ is primitive.
My question Let $I = [a, r + \omega]$ be a primitive ideal of $R$, where $a \gt 0, r$ are rational integers. How can we solve the following problems?
Determine whether $I$ is invertible or not.
If $I$ is invertible, find a free $\mathbb{Z}$-basis of $I^{-1}$.