import { PageBreaksXform } from "./page-breaks-xform.js";
import { ListXform } from "../list-xform.js";
/**
 * Xform for row page breaks (rowBreaks element in worksheet XML)
 * Used to define manual page breaks between rows when printing.
 */
class RowBreaksXform extends ListXform {
    constructor() {
        super({
            tag: "rowBreaks",
            count: true,
            childXform: new PageBreaksXform()
        });
    }
    // Override to add manualBreakCount attribute required by Excel
    render(xmlStream, model) {
        if (model && model.length) {
            xmlStream.openNode(this.tag, this.$);
            xmlStream.addAttribute(this.$count, model.length);
            xmlStream.addAttribute("manualBreakCount", model.length);
            const { childXform } = this;
            for (const childModel of model) {
                childXform.render(xmlStream, childModel);
            }
            xmlStream.closeNode();
        }
    }
}
export { RowBreaksXform };
