import { DBReader } from "./src/dbreader";
import { NWFetcher } from "./src/nwfetcher";
import _ from "lodash";
import { CNOCGFetcher } from "./src/cnocg";
import { ExtraCards } from "./src/ExtraCards";
import { DirectFetcher } from "./src/direct";
import Logger from "bunyan";
import { readLFList } from "./src/utility";
import fs from 'fs';

async function main() {
	const dbreader = new DBReader({
		name: "Database",
		//level: Logger.DEBUG
	});
	await dbreader.init();
	//const cards = await CNOCGFetcher.fetchOnce();
	//const missingExtraCards = ExtraCards.filter(c => !cards.some(cc => c.code === cc.code));
	//await dbreader.run(cards.concat(missingExtraCards));
	const cards = await DirectFetcher.fetchOnce();
	const lflist = await readLFList(await fs.promises.readFile("./lflist/lflist.conf", "utf-8"));
	await dbreader.run(cards, {
		extraBanlists: lflist,
	});
	process.exit();
}
main();
