
import type { IComponentClass } from '../children/ChildManager';
import type { Position } from '../composite/Position';
import type { IDynamicComponentDefinition } from '../composite';

export interface IAddChildOptions {
    slot?: string;
    props?: Record<string, unknown>;
    position?: Position;
    shellTag?: string; // Legacy support
    bindings?: Record<string, string>;
}

/**
 * Behavior for managing child actors.
 * Handles creation, removal, and tracking of children.
 */
export interface IChildManagementBehavior {
    /**
     * Add a child component.
     * @returns The mount path of the new child.
     */
    addChild(id: string, ComponentClass: IComponentClass, options?: IAddChildOptions): Promise<string>;

    /**
     * Remove a child component.
     */
    removeChild(id: string): Promise<void>;

    /**
     * Add a dynamic child from code/template.
     */
    addDynamicChild(params: IDynamicComponentDefinition): Promise<{
        mount: string;
        adapterId: string;
    }>;

    /**
     * List all dynamic children.
     */
    listDynamicChildren(): Array<{
        id: string;
        mount: string;
        shellTag?: string;
        createdAt?: number;
    }>;

    /**
     * Get a child's mount path by ID.
     */
    getChildMount(id: string): string | undefined;

    /**
     * Check if a child exists.
     */
    hasChild(id: string): boolean;
}
