import { APIBase } from '@dvn/core/api/apiBase';
export class AtamaApiImpl {
  constructor(endpoint, defaultHeaders = {}) {
    this.addAuthInterceptor = (token) => {
      this.api.addAuthInterceptor(token);
    };
    this.getPairsOfUser = (base, collection, userRefFieldId, userRefFieldValue) => this.api.get(`${base}/${collection}/pairs`, {
      'user-ref-field-id': userRefFieldId,
      'user-ref-field-value': userRefFieldValue,
    });
    this.getSelectionList = (base, collection, pairConfigId, userRefFieldId, memberToViewRefFieldId) => this.api.get(`${base}/${collection}/selection`, {
      'user-ref-field-id': userRefFieldId,
      'pair-config-id': pairConfigId,
      'member-to-view-ref-field-id': memberToViewRefFieldId,
    });
    this.getSentRequests = (base, collection, userRefFieldValue) => this.api.get(`${base}/${collection}/selection`, {
      'user-ref-field-value': userRefFieldValue,
    });
    this.getReceivedRequests = (base, collection) => this.api.get(`${base}/${collection}/selection`, {});
    this.getMeetingsOfUser = (base, collection, structureId, userRefFieldValue) => this.api.get(`${base}/${collection}/structure-meetings`, {
      'structure-id': structureId,
      'user-ref-field-value': userRefFieldValue,
    });
    this.endPair = (base, collection, pairId) => this.api.post(`${base}/${collection}/pairs/${pairId}/complete`, {});
    this.sendPairRequest = (base, collection, userRefFieldId, userRefFieldValue, memberToViewRefFieldId, memberToViewData) => this.api.post(`${base}/${collection}`, {
      userRefFieldId,
      userRefFieldValue,
      memberToViewRefFieldId,
      memberToViewData,
    });
    this.acceptPairRequest = (base, collection, requestId) => this.api.post(`${base}/${collection}`, {
      requestId,
    });
    this.rejectPairRequest = (base, collection, requestId) => this.api.post(`${base}/${collection}`, {
      requestId,
    });
    this.api = new APIBase(endpoint, defaultHeaders);
  }
}
