// Imports
import * as Auth from "/services/auth/auth.js";

// DOM elements

// local variables
let current_user;

export async function mount(where, parent) {
  const roundsComponent = new Round(parent);
  await roundsComponent.mount(where);
  return roundsComponent;
}

class Round {
  constructor(parent) {
    this.method = null;
    this.parent = parent;
  }

  async mount(where) {
    const mountpoint = where;
    document.getElementById(mountpoint).innerHTML = /* HTML */ `
      <header class="card-header">
        <p class="card-header-title">
          Tours
        </p>
        <button id="round-new" class="button is-success">
          <span class="icon is-small">
            <i class="fas fa-plus"></i>
          </span>
        </button>
      </header>
      <div class="card-content">
        <div id="rounds-list" class="content">Liste des tours</div>
      </div>
    `;
    current_user = await Auth.GetUser();
  }
}