import { APIBase } from '@dvn/core/api/apiBase';
export const STORAGE_KEY_KIMLIK_USER_ID = 'kimlik_uid';
export const STORAGE_KEY_KIMLIK_TOKEN = 'kimlik_token';
export 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.getUsers = () => this.api.get('users');
    // region api-keys
    this.createApiKey = (data) => this.api.post(`api-keys`, data);
    this.getApiKeys = () => this.api.get('api-keys');
    this.updateApiKey = (id, data) => this.api.put(`api-keys/${id}`, data);
    this.deleteApiKey = (id) => this.api.delete(`api-keys/${id}`);
    // endregion
    // region saml-configs
    this.createSAMLConfig = (data) => this.api.post(`saml-configs`, data);
    this.getSAMLConfigs = () => this.api.get('saml-configs');
    this.updateSAMLConfig = (id, data) => this.api.put(`saml-configs/${id}`, data);
    this.deleteSAMLConfig = (id) => this.api.delete(`saml-configs/${id}`);
    this.api = new APIBase(endpoint, defaultHeaders);
  }
  getDefaults() {
    return this.api.getDefaults();
  }
}
