import type { LineItem, DataFieldForActionAbstractTypes } from '@sap-ux/vocabularies-types/vocabularies/UI';
import type { AnnotationTerm, ConvertedMetadata, EntitySet, EntityType } from '@sap-ux/vocabularies-types';
import { type ManifestPathParams } from '../../common/utils';
import type { Definition } from 'typescript-json-schema';
import { type ExtensionLogger, type FileData, type Manifest } from '@sap/ux-specification-types';
import { v4, DefinitionName, TemplateType } from '@sap/ux-specification-types';
import type { ExtensionFileData } from '../types';
import type { MetadataInstanceInterface } from '../../common/decoration/factory';
export type CustomExtension = v4.TableCustomColumn | v4.CustomAction | v4.SapUi5RoutingTargetContentSection | v4.SapUiGenericAppPageCustomFilterField;
export interface CustomExtensions {
    [key: string]: CustomExtension;
}
export interface AddLineItemDefinitionParams {
    lineItemData: LineItemDataForSchema;
    actions: Definition;
    lineItemPath: string;
    lineItemRecord: DataFieldForActionAbstractTypes;
    index: number;
    lineItemDefinition?: Definition;
    columnDefinitionName: string;
}
export interface ImportActionSettingsOfReferenceParams {
    actionPropertyDefinition: Definition;
    appSchema: Definition;
    factory: MetadataInstanceInterface;
    actionsInConfig: object;
    actionKey: string;
    manifest: Manifest;
    routingId: string;
    manifestSectionId?: string;
    targetAnnotation?: string;
}
export declare const DATA_FIELD_FOR_ACTION_GROUP = "DataFieldForActionGroup";
/**
 * Adds extension at the right position of the sorted array of annotation-based nodes.
 *
 * @param extensions - list of extensions in manifest
 * @param sortedExtensionsArray - sorted array of annotation-based nodes, to be enhanced by extensions
 * @param extensionDefinitionName - extension definition name, different in LR and OP
 * @param templatePropertyName - The name of the property in the template to be used for processing.
 * @param logger - logger for error messages
 * @param ignoreAnnotationAnchors - calculation should ignore anchors referenced to annotation nodes. Used when annotations sections are merged.
 * @returns Sorted array of annotation-based nodes, enhanced by extensions
 */
export declare function addExtensionToArray(extensions: CustomExtensions, sortedExtensionsArray: [string, unknown][], extensionDefinitionName: string, templatePropertyName?: string, logger?: ExtensionLogger, ignoreAnnotationAnchors?: boolean): [string, unknown][];
/**
 * Adds enum values to the properties definition of a custom column.
 *
 * @param lineItems - current lineItems definition, with all records
 * @param customColumnDefinition - current custom column definition, in the app schema
 */
export declare function addEnumForProperties(lineItems: boolean | Definition, customColumnDefinition: Definition): void;
/**
 * Common function for enhancing the LineItems definition of app schema by custom columns.
 *
 * @param appSchema - app-specific JSON schema
 * @param v4Page - actual page in the manifest
 * @param logger - logger for error messages
 * @param customColumnDefinitionName - custom column definition name, distinguishes LR from OP
 * @param sectionId - identifier of the current object page section in schema
 * @param sectionIdInManifest - identifier of the current object page section in manifest
 */
export declare function addCustomColumnDefinition(appSchema: Definition, v4Page: v4.SapUiAppPageV4, logger: ExtensionLogger, customColumnDefinitionName?: string, sectionId?: string, sectionIdInManifest?: string): void;
/**
 * Adds an action record to a schema definition based on the provided line item definition parameters.
 * This involves defining action-specific properties, references, and metadata, and updating the schema accordingly.
 *
 * @param {AddLineItemDefinitionParams} lineItemDefinitionParams - The parameters describing the line item definition, including data, actions, path, record, and index.
 * @param {boolean} [createRef] - A flag indicating whether to create a reference for the action definition.
 * @returns {void} This function does not return a value.
 */
export declare function addActionRecordToSchema(lineItemDefinitionParams: AddLineItemDefinitionParams, createRef?: boolean): void;
/**
 * Adds a group action record to the schema based on the given parameters. This involves determining
 * action definitions, creating or referencing schema properties, and setting metadata fields.
 *
 * @param {AddLineItemDefinitionParams} lineItemDefinitionParams - Parameters that define the line item, including data, record, path, index, and actions.
 * @param {boolean} [createRef] - Indicates whether to create a reference for the action definition or to use an inline object.
 * @returns {void} - Does not return any value.
 */
export declare function addGroupActionRecordToSchema(lineItemDefinitionParams: AddLineItemDefinitionParams, createRef?: boolean): void;
/**
 * Adds a line item action definition to the schema based on the provided parameters.
 * Handles determining which action to take based on specific conditions of the line item record.
 *
 * @param {AddLineItemDefinitionParams} data - An object containing the details of the line item record and the line item definition.
 * @param {object} data.lineItemRecord - The record of the line item to be processed, containing relevant properties.
 * @param {boolean} data.lineItemRecord.Inline - Indicates whether the line item is inline.
 * @param {boolean} data.lineItemRecord.Determining - Indicates if the line item is determining.
 * @param {boolean} data.lineItemDefinition - Indicates whether the line item definition is present.
 * @returns {void} This method does not return a value.
 */
export declare function addLineItemActionDefinition(data: AddLineItemDefinitionParams): void;
/**
 * Adds a line item record to the provided schema based on the definition parameters.
 *
 * @param {AddLineItemDefinitionParams} lineItemDefinitionParams - The parameters defining the line item data, schema information, and record.
 * @returns {void} This function does not return a value.
 */
export declare function addLineItemRecordToSchema(lineItemDefinitionParams: AddLineItemDefinitionParams): void;
export type LineItemDataForSchema = {
    isObjectPage: boolean;
    isMacro?: boolean;
    appSchema: Definition;
    lineItemAnnotation: AnnotationTerm<LineItem>;
    entityType: EntityType;
    oDataServiceAVT: ConvertedMetadata;
    lineItemId: string;
};
/**
 * Appends line item columns and actions to the app schema (for the list report, custom page or an object page section comprising a table).
 *
 * @param {LineItemDataForSchema} data structure comprising
 * - appSchema - the app specific schema that shall get enhanced
 * - lineItemAnnotation - the UI.LineItem annotation, comprising all records
 * - entityType - the entity type as part of the AVT ConvertedMetadata
 * - oDataServiceAVT - complete service information, as returned by Annotation Vocabularies Tool
 * - lineItemId - in case of OP the parameter must be passed to distinguish the OP tables;
 *                in case of LR or ALP 'LineItems' is passed.
 * @param {Definition} actions - actions definition in schema, parent object
 * @param {string} lineItemPath - annotation path to the line item
 * @param {Definition | undefined} lineItemDefinition - line item definition
 * @param {string} columnDefinitionName - line item definition name
 */
export declare function appendLineItemsToSchema(data: LineItemDataForSchema, actions: Definition, lineItemPath: string, lineItemDefinition?: Definition, columnDefinitionName?: string): void;
/**
 * Adds the line item definition, columns and actions to the app schema (for the list report, custom page or an object page section comprising a table.
 *
 * @param data structure comprising
 * - isObjectPage - indicates that the page is an object page
 * - appSchema - the app specific schema that shall get enhanced
 * - lineItemAnnotation - the UI.LineItem annotation, comprising all records
 * - entityType - the entity type as part of the AVT ConvertedMetadata
 * - oDataServiceAVT - complete service information, as returned by Annotation Vocabularies Tool
 * - lineItemId - in case of OP the parameter must be passed to distinguish the OP tables;
 *                in case of LR or ALP 'LineItems' is passed.
 * @param columnDefinitionName - name of the column definition, i.e. TableColumn or ObjectPageTableColumn
 * @param customColumnDefinitionName - name of the custom column definition
 * @param customActionDefinitionName - name of the custom action definition
 */
export declare function addLineItemsTypeToSchema(data: LineItemDataForSchema, columnDefinitionName?: string, customColumnDefinitionName?: string, customActionDefinitionName?: string): void;
/**
 * Adds an enum or value help to position > anchor of custom column.
 *
 * @param appSchema - app specific JSON schema
 * @param lineItemId - ID of the current line item in schema
 * @param v4Page - current page in manifest
 * @param positionName - ID of the definition of custom column position in schema
 * @param sectionIdInManifest - identifier of the current object page section in manifest
 */
export declare function addFragmentEnumForAnchor(appSchema: Definition, lineItemId: string, v4Page: v4.SapUiAppPageV4, positionName?: string, sectionIdInManifest?: string): void;
/**
 * Adds an enum or value help to position > anchor of custom column or custom action.
 *
 * @param appSchema - app specific JSON schema
 * @param definitionId - definition key of actions
 * @param positionName - target definition to update
 */
export declare function addEnumForActionAnchor(appSchema: Definition, definitionId: string, positionName?: string): void;
/**
 * Find the relevant V4 page under the routing targets of manifest,json.
 *
 * @param pages - list of all pages in manifest
 * @param templateName - search criterion: template name
 * @param entitySet - search criterion: entity set object from AVT
 * @param contextPath - search criterion: contextPath
 * @returns the page definition in manifest (if found)
 */
export declare function findPageV4(pages: v4.SapUiAppPageV4[], templateName: string, entitySet?: EntitySet, contextPath?: string): v4.SapUiAppPageV4 | undefined;
/**
 * Depending on the template type, strip down the app schema so that only the relevant views are part of it.
 *
 * @param {Definition} appSchema - app specific JSON schema, to be adjusted
 * @param templateType - template type of the current page
 * @returns the right definition name for the table in the schema
 */
export declare function alignSchemaWithTemplateType(appSchema: Definition, templateType: TemplateType): DefinitionName.Table | DefinitionName.ALPTableView;
/**
 * Common function for enhancing LineItems, FieldGroups and Custom Section definitions of app schema by custom action definitions.
 *
 * @param appSchema - app-specific JSON schema
 * @param v4Page - actual page in the manifest
 * @param logger - logger for error messages
 * @param customActionDefinitionName - definition name of custom action
 * @param sectionDefinitionName - identifier of the current object page section in schema
 * @param sectionIdInManifest - identifier of the current object page section in manifest
 */
export declare function addCustomActionDefinition(appSchema: Definition, v4Page: v4.SapUiAppPageV4, logger: ExtensionLogger, customActionDefinitionName?: string, sectionDefinitionName?: string, sectionIdInManifest?: string): void;
/**
 * Common function for enhancing header and footer definitions of app schema by custom action definitions.
 *
 * @param appSchema - app-specific JSON schema
 * @param v4Page - actual page in the manifest
 * @param logger - logger for error messages
 * @param customActionDefinitionName - definition name of custom action
 * @param sectionId - identifier of the current object page section in schema
 */
export declare function addHeaderFooterCustomActionDefinition(appSchema: Definition, v4Page: v4.SapUiAppPageV4, logger: ExtensionLogger, customActionDefinitionName?: DefinitionName, sectionId?: string): void;
/**
 * Method returns page from manifest by passed page key.
 *
 * @param manifest Object from manifest.json.
 * @param pageId Page id.
 * @param logger Logger to report error of unexisting page.
 * @returns Manifest's target page.
 */
export declare function getManifestPage(manifest: Manifest, pageId: string, logger?: ExtensionLogger): v4.RoutingTargetOptions | undefined;
/**
 * Method finds custom view/section XML file for passed page.
 *
 * @param files All extension files.
 * @param page - the page object containing routing target options
 * @param manifest Object from manifest.json.
 * @param xmlType XML file type - view or fragment.
 * @param extensionName Extension namespace or path to extension name in page object.
 * @returns Custom page's data containing XML file.
 */
export declare function getPageCustomExtensionFile(files: FileData[], page: v4.RoutingTargetOptions, manifest: Manifest, xmlType: 'view' | 'fragment', extensionName: string): ExtensionFileData | undefined;
/**
 * Method finds view XML file for passed page.
 *
 * @param files All view files.
 * @param pageId Page id.
 * @param manifest Object from manifest.json.
 * @param logger Logger.
 * @returns Custom page's data containing view XML file.
 */
export declare function getPageCustomViewFile(files: FileData[], pageId: string, manifest: Manifest, logger?: ExtensionLogger): ExtensionFileData | undefined;
/**
 * Adds custom section or custom sub section definitions to app schema.
 *
 * @param appSchema - app-specific JSON schema
 * @param definition - sections definition
 * @param v4Page - actual page in the manifest
 * @param customSectionRef - value of custom section ref
 * @param isMergedSections - are merged section used
 * @param facetKey - facet key
 * @param logger - logger for error messages
 */
export declare function addCustomSectionDefinition(appSchema: Definition, definition: Definition, v4Page: v4.SapUiAppPageV4, customSectionRef: string, isMergedSections: boolean, facetKey?: string, logger?: ExtensionLogger): void;
/**
 * Method adds custom filter fields from manifest to schema properties.
 *
 * @param appSchema - app-specific JSON schema
 * @param definition - filter fields definition
 * @param v4Page - actual page in the manifest
 */
export declare function addCustomFilterFieldDefinition(appSchema: Definition, definition: Definition, v4Page: v4.SapUiAppPageV4): void;
/**
 * Imports the action settings of a specified reference based on the given parameters.
 *
 * @param {object} importActionParams - The parameters required for importing action settings.
 * @param {object} importActionParams.actionPropertyDefinition - The action property definition containing the $ref to the reference.
 * @param {object} importActionParams.appSchema - The application schema containing definitions and other related metadata.
 * @returns {void} This function does not return a value.
 */
export declare function importActionSettingsOfReference(importActionParams: ImportActionSettingsOfReferenceParams): void;
/**
 * Enhances the application schema with custom field definitions for Object Page sections.
 *
 * @param appSchema - The application-specific JSON schema object representing the Object Page.
 * @param v4Page - The current Object Page configuration from the manifest (V4 format).
 * @param fieldGroupInManifest - The manifest identifier for the Object Page section associated with the field definitions.
 * @param logger - Logger instance for reporting or debugging schema processing errors.
 * @param customFieldDefinitionName - The schema definition name to be used for custom fields (defaults to `CustomTableAction`).
 * @param fieldsDefinitionName - The schema definition name for the set of fields being enhanced.
 */
export declare function addCustomFieldDefinition(appSchema: Definition, v4Page: v4.SapUiAppPageV4, fieldGroupInManifest: string, logger: ExtensionLogger, customFieldDefinitionName: string, fieldsDefinitionName: string): void;
/**
 * Adds 'manifestPath' to each property in a definition based on metadata sync rules.
 *
 * @param {string} appSchema - Full schema.
 * @param {string | undefined} definitionName - The name of the definition/class whose properties are being processed.
 *   If `undefined`, the function attempts to resolve the definition name from the `$ref` property of the provided definition.
 * @param {Definition} definition - The definition object containing property schemas.
 * @param {ManifestPathParams} pathParams - Additional context required to compute manifest paths.
 * @param handleRelative - A flag indicating whether to use relative paths for definition properties.
 */
export declare function addManifestPathsToProperties(appSchema: Definition, definitionName: string | undefined, definition: Definition, pathParams: ManifestPathParams, handleRelative?: boolean): void;
/**
 * Returns the manifest path for a given page based on the provided path parameters.
 *
 * @param {ManifestPathParams} pathParams - Parameters containing page information for path resolution.
 * @returns {string | undefined} The resolved manifest path as a string, or undefined if not applicable.
 */
export declare function getPageManifestPath(pathParams: ManifestPathParams): string | undefined;
/**
 * Creates a section-specific personalization schema definition by cloning the base personalization definition
 * and optionally updating the reference in the associated table definition's personalization property.
 *
 * @param appSchema - The application schema
 * @param definitionName - The base personalization definition name (e.g. PersonalizationTypeOP)
 * @param idOrKey - The line item id or facet key used to create the specific definition key
 * @param tableDefinitionName - The name of the table definition containing the personalization property
 * @returns The key of the newly created section-specific personalization definition
 */
export declare function initializePersonalizationSchema(appSchema: Definition, definitionName: string, idOrKey: string, tableDefinitionName: string): string;
//# sourceMappingURL=utils.d.ts.map