const transform = require('../transform');
const prepare = require('../prepare');
const filename = require('./filename');


async function seisjson ({project, sequence}) {
	const {events, sequences} = await prepare(project, {sequence});
	const data = transform(events, sequences, {projectId: project});
	const name = filename(sequences.find(i => i.sequence == sequence), ".json");

	return { name, data, mimetype: "application/vnd.seis+json" };
}

module.exports = seisjson;
