IF AND ONLY IF

(1) a child is the subject of a proceeding under this chapter, AND
(2) the child is mentally ill, AND
(3) the child needs care, training, or treatment because of the mental illness, AND
(4) all available less drastic alternatives to committing the child to the temporary legal custody of the department are unsuitable to meet the child’s needs for care, training, or treatment for the mental illness,

THEN

(5) a juvenile court may commit the child to the temporary legal custody of the department in proceedings conducted in conformity with §§ 33-3-602 – 33-3-608, 33-3-610 – 33-3-620, and 33-6-505 – 33-6-508, to meet the child’s needs for care, training, or treatment for the mental illness.