'use strict';

const apiBase = require('./apiBase-b14a8285.js');

const STORAGE_KEY_KIMLIK_USER_ID = 'kimlik_uid';
const STORAGE_KEY_KIMLIK_TOKEN = 'kimlik_token';
class KimlikApiImpl {
  constructor(endpoint, defaultHeaders = {}) {
    this.register = (email, firstName, lastName, password) => this.api.post('register', { email, firstName, lastName, password });
    this.login = (email, password) => this.api.post('login', { email, password });
    this.activateUser = (email, firstName, lastName, password) => this.api.post('', // 'activate/email',
    { email, firstName, lastName, password });
    this.logout = () => this.api.post('logout', {});
    this.addAuthInterceptor = (token) => {
      this.api.addAuthInterceptor(token);
    };
    this.getSession = () => this.api.get('session');
    this.api = new apiBase.APIBase(endpoint, defaultHeaders);
  }
  getDefaults() {
    return this.api.getDefaults();
  }
}

exports.KimlikApiImpl = KimlikApiImpl;
exports.STORAGE_KEY_KIMLIK_TOKEN = STORAGE_KEY_KIMLIK_TOKEN;
exports.STORAGE_KEY_KIMLIK_USER_ID = STORAGE_KEY_KIMLIK_USER_ID;
