// Fusion Accounting - Bank Reconciliation View Embedder
// Copyright (C) 2026 Nexa Systems Inc.

import { View } from "@web/views/view";
import { Component, useSubEnv } from "@odoo/owl";

/**
 * BankRecViewEmbedder - Wrapper component for embedding sub-views
 * within the bank reconciliation form, resetting the control panel
 * context for clean view rendering.
 */
export class BankRecViewEmbedder extends Component {
    static props = ["viewProps"];
    static template = "fusion_accounting.BankRecViewEmbedder";
    static components = { View };

    setup() {
        // Little hack while better solution from framework js.
        // Reset the config, especially the ControlPanel which was coming from a parent form view.
        // It also reset the view switchers which was necessary to make them disappear.
        useSubEnv({
            config: {...this.env.methods},
        });
    }
}
