"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PrintOptionsXform = void 0;
const base_xform_1 = require("../base-xform.js");
function booleanToXml(model) {
    return model ? "1" : undefined;
}
class PrintOptionsXform extends base_xform_1.BaseXform {
    get tag() {
        return "printOptions";
    }
    render(xmlStream, model) {
        if (model) {
            const attributes = {
                headings: booleanToXml(model.showRowColHeaders),
                gridLines: booleanToXml(model.showGridLines),
                horizontalCentered: booleanToXml(model.horizontalCentered),
                verticalCentered: booleanToXml(model.verticalCentered)
            };
            if (Object.values(attributes).some((value) => value !== undefined)) {
                xmlStream.leafNode(this.tag, attributes);
            }
        }
    }
    parseOpen(node) {
        switch (node.name) {
            case this.tag:
                this.model = {
                    showRowColHeaders: node.attributes.headings === "1",
                    showGridLines: node.attributes.gridLines === "1",
                    horizontalCentered: node.attributes.horizontalCentered === "1",
                    verticalCentered: node.attributes.verticalCentered === "1"
                };
                return true;
            default:
                return false;
        }
    }
    parseText() { }
    parseClose() {
        return false;
    }
}
exports.PrintOptionsXform = PrintOptionsXform;
