{{!
    This file is part of Moodle - http://moodle.org/

    Moodle is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Moodle is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
}}
{{!
    @template local_learnwise/assistantwidget

    TODO describe template assistantwidget

    Example context (json):
    {
      "assistantid": "TEMPID",
      "courseid": "4",
      "userid": "2",
      "userfullname": "Admin User",
      "useremail": "admin@test.com",
      "remotehost": "https:\/\/aiden.sandbox.learnwise.dev",
      "chathost": "https:\/\/chat.sandbox.learnwise.dev"
    }
}}
<script>
    window.learnWiseSetup = {
        host: {{#quote}}{{{ remotehost }}}{{/quote}},
        chatSrc: {{#quote}}{{{ chathost }}}{{/quote}},
        assistantId: {{#quote}}{{{ assistantid }}}{{/quote}},
        courseId: {{#courseid}}{{#quote}}{{{ courseid }}}{{/quote}}{{/courseid}}{{^courseid}}null{{/courseid}},
        lmsUserId: {{#quote}}{{{ userid }}}{{/quote}},
        name: {{#quote}}{{{ userfullname }}}{{/quote}},
        email: {{#quote}}{{{ useremail }}}{{/quote}},
        region: {{#quote}}{{{ region }}}{{/quote}},
    };

    var script = document.createElement("script");
    script.src = window.learnWiseSetup.host + "/chat_launcher.js";
    document.head.appendChild(script);
</script>
