{{!
    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 aiprovider_datacurso/webservice/token_registration
  Renders token existence/created info and registration status block.

  Example context (json):
  {
    "tokenexists": true,
    "tokencreated": "1 January 2025, 14:00",
    "registration": {
      "verified": true,
      "lastsent": "2025-01-01 14:00",
      "laststatus": "Registered"
    }
  }
}}
<div class="row mb-3">
  <div class="col-md-6">
    <div class="d-flex align-items-center mb-2">
      <span class="badge mr-2 {{#tokenexists}}badge-success{{/tokenexists}}{{^tokenexists}}badge-danger{{/tokenexists}}" data-region="aiprovider_datacurso/token-badge">
        {{#tokenexists}}{{#str}} exists, aiprovider_datacurso{{/str}}{{/tokenexists}}{{^tokenexists}}{{#str}} missing, aiprovider_datacurso{{/str}}{{/tokenexists}}
      </span>
      <strong>{{#str}} ws_tokenexists, aiprovider_datacurso {{/str}}</strong>
    </div>
    {{#tokenexists}}
      {{#tokencreated}}
        <small class="text-muted" data-region="aiprovider_datacurso/token-created">{{#str}} created, aiprovider_datacurso{{/str}}: {{tokencreated}}</small>
      {{/tokencreated}}
    {{/tokenexists}}
  </div>
  <div class="col-md-6">
    <div class="d-flex align-items-center mb-2">
      <span class="badge mr-2 {{#registration.verified}}badge-success{{/registration.verified}}{{^registration.verified}}badge-warning{{/registration.verified}}" data-region="aiprovider_datacurso/registration-badge">
        {{#registration.verified}}{{#str}} verified, aiprovider_datacurso{{/str}}{{/registration.verified}}{{^registration.verified}}{{#str}} pending, aiprovider_datacurso{{/str}}{{/registration.verified}}
      </span>
      <strong>{{#str}} registration_status, aiprovider_datacurso {{/str}}</strong>
    </div>
    {{#registration.lastsent}}
      <small class="text-muted" data-region="aiprovider_datacurso/registration-lastsent">{{#str}} last_sent, aiprovider_datacurso{{/str}}: {{registration.lastsent}}{{#registration.laststatus}} — {{registration.laststatus}}{{/registration.laststatus}}</small>
    {{/registration.lastsent}}
  </div>
</div>

{{#registration.verified}}
  <div class="alert alert-success mb-3">
    <i class="fa fa-check-circle mr-2"></i>{{#str}} registration_verified, aiprovider_datacurso {{/str}}
  </div>
{{/registration.verified}}
{{^registration.verified}}
  <div class="alert alert-warning mb-3">
    <i class="fa fa-exclamation-triangle mr-2"></i>{{#str}} registration_notverified, aiprovider_datacurso {{/str}}
  </div>
{{/registration.verified}}
