import { session } from "./State";
import { wrapSessionMethod } from "./Util";
const getPrimaryArticlesOfSet = () => [];
const getAllArticles = () => session.getArticlesOfType("graphical");
const getAllSets = () => session.getArticlesOfType("set");
const getArticlesOfSet = (comId) => {
    const set = session.getArticleByComId(comId);
    if (set === undefined) {
        return [];
    }
    return set.children.map(comId => session.getArticleByComId(comId));
};
export const articleState = {
    getPrimaryArticlesOfSet,
    getAllArticles,
    getAllItems: wrapSessionMethod("getAllArticles"),
    getAllSets,
    getArticlesOfSet,
    getArticleByComId: wrapSessionMethod("getArticleByComId"),
    getArticleByGfxId: wrapSessionMethod("getArticleByGfxId"),
    getItemByComId: wrapSessionMethod("getArticleByComId"),
    getArticleConfiguration: wrapSessionMethod("getArticleConfiguration"),
    getArticleData: wrapSessionMethod("getArticleData"),
    getArticleInfo: wrapSessionMethod("getArticleInfo"),
    getArticlesBySource: wrapSessionMethod("getArticlesOfSource"),
    getSetByComId: wrapSessionMethod("getArticleByComId"),
    getHeadArticle: wrapSessionMethod("getArticleByComId"),
    getItemConfiguration: wrapSessionMethod("getArticleConfiguration"),
};
