import { BaseXform } from "../base-xform.js";
class TableColumnXform extends BaseXform {
    constructor() {
        super();
        this.model = { name: "" };
    }
    get tag() {
        return "tableColumn";
    }
    prepare(model, options) {
        model.id = options.index + 1;
    }
    render(xmlStream, model) {
        xmlStream.leafNode(this.tag, {
            id: model.id.toString(),
            name: model.name,
            totalsRowLabel: model.totalsRowLabel,
            // Excel doesn't output totalsRowFunction when value is 'none'
            totalsRowFunction: model.totalsRowFunction === "none" ? undefined : model.totalsRowFunction,
            dxfId: model.dxfId
        });
    }
    parseOpen(node) {
        if (node.name === this.tag) {
            const { attributes } = node;
            this.model = {
                name: attributes.name,
                totalsRowLabel: attributes.totalsRowLabel,
                totalsRowFunction: attributes.totalsRowFunction,
                dxfId: attributes.dxfId
            };
            return true;
        }
        return false;
    }
    parseText() { }
    parseClose() {
        return false;
    }
}
export { TableColumnXform };
