// Fusion Accounting - Journal Report Move Line List
// Copyright (C) 2026 Nexa Systems Inc.

import { registry } from "@web/core/registry";
import { AccountMoveLineListRenderer, AccountMoveLineListView } from "@fusion_accounting/components/move_line_list/move_line_list";

/**
 * JournalReportAccountMoveLineReconcileListRenderer - Custom list renderer
 * for journal report move lines with auto-expanded group toggling.
 */
export class JournalReportAccountMoveLineReconcileListRenderer extends AccountMoveLineListRenderer {
    setup() {
        super.setup();
        this.props.list.groups?.forEach(group => {
            group.list?.groups?.forEach(innerGroup => {
                this.toggleGroup(innerGroup);
            });
        });
    }
}

export const JournalReportAccountMoveLineReconcileLineListView = {
    ...AccountMoveLineListView,
    Renderer: JournalReportAccountMoveLineReconcileListRenderer,
};

registry.category("views").add("account_move_line_journal_report_list", JournalReportAccountMoveLineReconcileLineListView);
