/*
 * ******************************************************************
 * Copyright (c) 2024 Broadcom. All Rights Reserved.
 * Broadcom Confidential. The term "Broadcom" refers to Broadcom Inc.
 * and/or its subsidiaries.
 * ******************************************************************
 */

import { InjectionToken } from "@angular/core";
import { Observable } from "rxjs";

export const COMPONENT_SCOPE_PREFIX = "urn:vmware:vcd:component-scope";

export const HYPER_PLUGIN_CONFIG = new InjectionToken<HyperpluginConfig>("HYPER_PLUGIN_CONFIG");

export type THEME_MODE = "light" | "dark";
export type HYPER_PLUGIN_THEME_TYPE = Observable<THEME_MODE>;
export const HYPER_PLUGIN_THEME = new InjectionToken<HYPER_PLUGIN_THEME_TYPE>("HYPER_PLUGIN_THEME");

export enum HyperPluginViewEncapsulation {
    /**
     * Doesn't include any CSS, all styles are inherited from the hosting application.
     * 
     * This is the default option.
     */
    Inherited = 0,
    /**
     * Emulates a native Shadow DOM encapsulation behavior by adding a specific attribute to the
     * component's host element and applying the same attribute to all the CSS selectors.
     */
    Emulated = 1,
    /**
     * Uses the browser's native Shadow DOM API to encapsulate CSS styles, meaning that it creates
     * a ShadowRoot for the component's host element which is then used to encapsulate
     * all the Component's styling.
     */
    ShadowDom = 2
}

export interface HyperpluginConfig {
    root: string,
    useHash?: boolean,
    routes: {
        path: string;
        type: string;
        fullHeight?: boolean;
    }[];
    encapsulation?: HyperPluginViewEncapsulation;
    tokenHolder?: {
        localStorage?: {
            [key: string]: {
                propertyPath: string;
                fallbackPropertyPath?: string;
                defaultValue?: string;
            }
        }
    }
    coreBasePxSize?: number;
}