const { pool } = require('../connection');

/** Retrieve vessel info.
 *
 * @a vesselID The ID of the target vessel. Defaults to `ego`
 * which is this server's parent vessel.
 */
async function info (vesselID = "ego") {

	const text = `
		SELECT *
		FROM keystore
		WHERE type = 'vessel' AND key = $1;
	`;

	const res = await pool.query(text, [ vesselID ]);
	return res.rows[0]?.data ?? {};

}

module.exports = {
	info
};
