/*
 * Copyright 2018-2025 VMware, Inc. All rights reserved. VMware Confidential
 */
import { NgModuleRef } from "@angular/core";
import { ExtensionPointManifest } from "./extensibility.model";
import { ExternalExtensionLoaderState } from "./loader/extension-loader.model";

/**
 * When the UI loads an extension, it will iterate through every defined {@link ExtensionPointManifest} and determine
 * how to initialize (bootstrap) it.  This functionality is be provided by instances of this class registered with
 * {@link EXTENSION_POINT_HANDLER}.
 */
export interface ExtensionPointHandler {
    /**
     * This method takes the version of VCD in the {@link ExtensionPointManifest} and the {@link ExtensionPointManifest}
     * type and returns whether or not the handler supports the combination.  For example, a handler may support
     * extensions written for VCD 11.x and of type "datacenter-overview".
     * @param extensionManifestContainerVersion container version defined in the extension manifest
     * @param extensionPointType type of the extension point
     */
    supports(extensionManifestContainerVersion: string, extensionPointType: string): boolean;

    /**
     * The bootstrap method performs low-level initialization and preparation of an Extension Point.
     * @param extensionBundle the systemJS bundle for the extension
     * @param extensionAngularModule the compiled and prepared factory for the extension' Angular module
     * @param extensionPointManifest the extension point manifest
     * @param ordering the sequential ordering of the extension point
     */
    bootstrap(
        extensionBundle: any,
        extensionAngularModule: NgModuleRef<any>,
        extensionPointManifest: ExtensionPointManifest,
        ordering: number,
        state: ExternalExtensionLoaderState
    );
}
