import { Lang } from "./mongodb";

export const getLang = async (language = "en") => {
    const lang = await Lang(language);
    return {
        general: (await lang[0].find({}).toArray()).map(({ _id, ...rest }) => rest),
        buildings: (await lang[1].find({}).toArray()).map(({ _id, ...rest }) => rest),
        ships: (await lang[2].find({}).toArray()).map(({ _id, ...rest }) => rest),
        resources: (await lang[3].find({}).toArray()).map(({ _id, ...rest }) => rest),
        research: (await lang[4].find({}).toArray()).map(({ _id, ...rest }) => rest),
        structures: (await lang[5].find({}).toArray()).map(({ _id, ...rest }) => rest),
        defenses: (await lang[6].find({}).toArray()).map(({ _id, ...rest }) => rest)
    }
}