// add a list

import { CreateDocx, ListNested, OptionsList } from "../../../build";
import * as fs from "fs";

const docx = new CreateDocx();

docx.addText("Bullets list:");

const items: ListNested = [
    "Item 1",
    "Item 2",
    ["Item A", "Item B", "Item C", ["Item C.1", "Item C.2"]],
    "Item 3",
    "Item 4",
    "Item 5",
];
const optionsListBullets: OptionsList = {
    type: "bullets",
};
docx.addList(items, optionsListBullets);

docx.addText("Numbering list:");

const optionsListNumerical: OptionsList = {
    type: "numbering",
};
docx.addList(items, optionsListNumerical);
docx.addList(items, optionsListNumerical);

docx.save().then(contents => {
    fs.writeFileSync("addList_1.docx", Buffer.from(contents));
});
