/* eslint-disable @typescript-eslint/no-explicit-any */
// #region Imports
import { ControllerBase } from '../../Controls/Controllers/Abstracts/ControllerBase';
import { createDropListGroupRef } from '../Core/DropListGroupRef';
// #endregion
// #region DropListGroupController
/**
 * Lit Reactive Controller for drop list group functionality.
 * Wraps DropListGroupRef to integrate with Lit components.
 *
 * Automatically connects all child drop lists to each other,
 * enabling drag-and-drop between them without manual configuration.
 *
 * Equivalent to Angular CDK's CdkDropListGroup.
 *
 * @public
 */
export class DropListGroupController extends ControllerBase {
    // #region Fields
    _groupRef = null;
    _config;
    _initialized = false;
    // #endregion
    // #region Ctor
    /**
     * Create a new DropListGroupController.
     *
     * @param host - Host component.
     * @param config - Configuration options.
     */
    constructor(host, config) {
        super(host);
        this._config = config ?? {};
        console.log('[DropListGroupController] Created', { config });
    }
    // #endregion
    // #region ControllerBase Lifecycle
    /**
     * Called when the host connects to the DOM.
     *
     * @public
     * @override
     */
    hostConnected() {
        super.hostConnected();
        if (!this._initialized) {
            this._initialize();
            this._initialized = true;
        }
    }
    /**
     * Called when the host disconnects from the DOM.
     *
     * @public
     * @override
     */
    hostDisconnected() {
        super.hostDisconnected();
        this._cleanup();
    }
    // #endregion
    // #region Properties
    /**
     * Get the underlying DropListGroupRef.
     *
     * @public
     */
    get groupRef() {
        return this._groupRef;
    }
    /**
     * Get/set disabled state.
     *
     * @public
     */
    get disabled() {
        return this._groupRef?.disabled ?? false;
    }
    set disabled(value) {
        if (this._groupRef) {
            this._groupRef.disabled = value;
        }
    }
    /**
     * Get all registered drop lists.
     *
     * @public
     */
    get dropLists() {
        return this._groupRef?.dropLists ?? new Set();
    }
    // #endregion
    // #region Methods
    /**
     * Register a drop list with this group.
     *
     * @param dropList - Drop list to register.
     *
     * @public
     */
    registerDropList(dropList) {
        this._groupRef?.registerDropList(dropList);
    }
    /**
     * Unregister a drop list from this group.
     *
     * @param dropList - Drop list to unregister.
     *
     * @public
     */
    unregisterDropList(dropList) {
        this._groupRef?.unregisterDropList(dropList);
    }
    // #endregion
    // #region Private Methods
    /**
     * Initialize the controller.
     *
     * @private
     */
    _initialize() {
        console.log('[DropListGroupController] Initializing');
        this._groupRef = createDropListGroupRef(this._config);
    }
    /**
     * Clean up the controller.
     *
     * @private
     */
    _cleanup() {
        console.log('[DropListGroupController] Cleaning up');
        if (this._groupRef) {
            this._groupRef.dispose();
            this._groupRef = null;
        }
        this._initialized = false;
    }
}
// #endregion
//# sourceMappingURL=DropListGroupController.js.map