"use strict";

const Promise = require("bluebird");
const mmAxios = require("@modular-matrix/axios");

const { validateArguments } = require("@validatem/core");
const required = require("@validatem/required");
const isSession = require("@modular-matrix/is-session");

module.exports = function getThumbnail(_session) {
	let [ session ] = validateArguments(arguments, {
		session: [ required, isSession ]
	});

	let axios = mmAxios({ session: session });

	return Promise.try(() => {
		return axios.get("/media/r0/config");
	}).then((response) => {
		return { limit: response.data["m.upload.size"] };
	});
};
