const axios = require('axios');

function WopiAPI() {}

WopiAPI.prototype.getPassports = function (fileID) {
  const requestConfig = {
    headers: {
      publicKey: window.viamApi.getConfig().headers.publicKey,
      uuid: window.viamApi.getConfig().headers.uuid,
      token: window.viamApi.getConfig().headers.token,
      deviceHash: window.viamApi.getConfig().headers.deviceHash,
      userAgent: window.viamApi.getConfig().headers.userAgent,
      fileID
    }
  };

  const [protocol, host] = window.API_HOST.split(':');

  const url = `${protocol}${host}${window.WOPI_URI_PREFIX}/getPassports`;
  return axios.post(url, {}, requestConfig);
};

module.exports = WopiAPI;