/**
 * Core manifest type definitions for Dynatrace Application development via the Wave CLI.
 *
 * This file contains two principal interfaces:
 *  - DynatraceApplicationManifest: The shape of an application's manifest (authoring time)
 *  - AppManifestSchema: A JSON Schema representation meta-structure used internally
 *
 * Notes:
 *  - Keep property names in sync between DynatraceApplicationManifest and any generation logic.
 *  - When extending the manifest, always add accompanying documentation here to keep the contract clear.
 */
import type { ActionManifest, CSPAppDirectives, DocumentsManifest, DocumentTypesManifest, FunctionManifest, FunctionSandbox, IntentsDeclarations, OAuthScope, SettingsManifest } from '../utils/config/cli-options';
import type { UiCommands } from './ui-commands';
export type DynatracePlatformDependency = {
    name: string;
    version: string;
};
export type DynatraceLibraryDependency = {
    name: string;
    version: string;
};
export type DependencyMetadata = {
    packageJsonDep?: string;
    path?: string;
};
export type DynatraceDependency = (DynatracePlatformDependency & DependencyMetadata) | (DynatraceLibraryDependency & DependencyMetadata);
export type AppIcon = {
    /** Path to the custom app icon relative to the app bundle root */
    name: 'icon.svg' | 'icon.png';
    /** Whether the app icon has been automatically generated */
    generated: boolean;
};
/**
 * Interface defining the manifest structure.
 * @internal
 */
export interface DynatraceApplicationManifest {
    /** App id */
    id: string;
    /** App name */
    name: string;
    /** App description */
    description: string;
    /** App version */
    version: string;
    /** Metadata of all Dynatrace packages that contain a dynatrace-metadata.json */
    dependencies?: DynatracePlatformDependency[];
    /** Metadata of all Dynatrace library packages included in the bundle (name + resolved version) */
    packages?: DynatraceLibraryDependency[];
    /** Hide in App Launcher */
    hidden?: boolean;
    /** Intent capabilities */
    intents?: IntentsDeclarations;
    /** Action capabilities */
    actions?: ActionManifest[];
    /** App widget settings */
    settings?: SettingsManifest;
    /** Function capabilities */
    functions?: Record<string, FunctionManifest>;
    /** App documents */
    documents?: DocumentsManifest;
    /** App document types */
    'document-types'?: DocumentTypesManifest;
    /** Page tokens */
    pageTokens?: Record<string, string>;
    /** App icon options */
    icon: AppIcon;
    /**
     * Represents a custom set of directives for the app
     * The value holds the actual directive.
     * For every directive there needs to be a comment provided that explains why this directive is necessary.
     */
    csp?: CSPAppDirectives;
    /**
     * Defines special sandbox options that could be enable for functions
     */
    functionSandbox?: FunctionSandbox;
    /**
     * The list of authentication scopes your app needs.
     */
    scopes: OAuthScope[];
    /**
     * The "SemVer" version of the app bundle.
     */
    'app-bundle-version'?: string;
    /**
     * App ui Commands.
     */
    uiCommands?: UiCommands;
}
/**
 * JSON Schema wrapper describing the expected structure of the Dynatrace application manifest.
 * This is NOT the manifest itself, but the schema metadata used for validation / generation.
 */
export interface AppManifestSchema {
    /**
     * JSON Schema URI identifying the draft / meta schema used (e.g. "https://json-schema.org/draft/2020-12/schema").
     */
    $schema: string;
    /**
     * Unique identifier of this schema resource (used for $ref resolution / tooling).
     */
    $id: string;
    /**
     * Root JSON type of the manifest document. Should always be 'object'.
     */
    type: string;
    /**
     * JSON Schema property definitions keyed by the known manifest fields.
     * Each value is itself a (partial) JSON Schema fragment describing that field.
     */
    properties: {
        [K in keyof DynatraceApplicationManifest]?: unknown;
    };
    /**
     * The currently supported highest app bundle version that this CLI understands.
     */
    'current-app-bundle-version': string;
    /**
     * Whether additional (undeclared) properties are permitted in the manifest (normally false).
     */
    additionalProperties: boolean;
    /**
     * List of manifest fields that must be present for a valid manifest.
     */
    required: string[];
}
