A committed person has the right to be represented by counsel at any proceeding under this chapter. The court shall appoint a qualified attorney to represent the committed person if neither the committed person nor others provide counsel. The attorney shall be appointed at the time a petition for commitment is filed. In all proceedings under this chapter, the attorney shall:
(1) consult with the person prior to any hearing;
(2) be given adequate time and access to records to prepare for all hearings;
(3) continue to represent the person throughout any proceedings under this chapter unless released as counsel by the court; and
(4) be a vigorous advocate on behalf of the person.