The central problem with this idea of euthanasia for the mentally ill is the logical fact that those suffering mental illness are not able to make sound mind decisions.
This then leads to the problem of others making the decision to end their life on the behalf of the patient.
The only possible way I see to avoid the problems that raises is the enactment of a living will, made while sound of mind, specifying end of life treatments.
Even there the person signing the will needs to be in possession of medical knowledge they almost certainly don’t have.