import { IGXE } from "@intelligentgraphics/igd.productdata";
import { GenericInstanceList, GenericInstance } from "./Util";
export declare type PropertyGrouper = (sources: GenericInstanceList[]) => PropertyGroup[] | Promise<PropertyGroup[]>;
export declare type LabelFactory = (templateArticles: GenericInstance | GenericInstanceList, groupProperties: IGXE.IProperty[]) => string;
export interface PropertyGroup {
    groupId: string;
    properties: IGXE.IProperty[];
    /**
     * ComIds of articles which are referenced by this group
     *
     * @type {(string[] | string)}
     */
    references: string[] | string;
    groupLabel: string;
    isMerged: boolean;
}
/**
 * Creates a single group for each of the provided articles
 *
 * @param {*} sources
 * @returns
 */
export declare const byComId: PropertyGrouper;
/**
 * Creates a common item for each source id
 *
 * @param {Article[][]} sources
 * @returns
 */
export declare const bySource: PropertyGrouper;
export declare enum GroupPropertyMergeBehaviour {
    /**
     * Adds all non conflicting properties to a merge group
     */
    union = "union",
    /**
     * Only adds propeties which exist on all group articles to the merged group
     */
    intersection = "intersection"
}
export declare enum ChoiceListMergeBehaviour {
    /**
     * Allows merged property value lists to
     * contain an intersection of the value lists of multiple properties
     */
    allowPartialValueList = "allowPartialValueList",
    /**
     * Only allows merged properties when a value list matches in length and content
     */
    onlyCompleteValueList = "onlyCompleteValueList"
}
export declare enum GroupContent {
    /**
     * Create merged groups and a group for each article with all of its properties
     */
    all = "all",
    /**
     * Only create groups for merged properties (will create a group for an article if the article count equals one)
     */
    onlyMerged = "onlyMerged",
    /**
     * Create merged groups and a group for each article containing the non merged properties
     */
    mergedAndRest = "mergedAndRest"
}
export declare type MergeProperties = (a: IGXE.IProperty, b: IGXE.IProperty, settings: MergePropertiesSettings) => false | IGXE.IProperty;
export interface MergePropertiesSettings {
    choiceListMergeBehaviour: ChoiceListMergeBehaviour;
}
export declare enum PropertySortMode {
    /**
     * Sorts properties alphabetically by their text property
     */
    alphabetical = "alphabetical",
    /**
     * Sorts properties by their position property
     */
    position = "position",
    /**
     * Sorts properties by their position property and if in ambigous cases alphabetical
     */
    positionThenAlphabetical = "positionThenAlphabetical"
}
export declare type PropertySorter = (properties: IGXE.IProperty[], sortMode: PropertySortMode, group: PropertyGroup) => IGXE.IProperty[];
export interface BuildOptions {
    sources: GenericInstanceList[];
    mergeBehaviour?: GroupPropertyMergeBehaviour;
    displayMode?: GroupContent;
    createLabel?: LabelFactory;
    mergeProperties?: MergeProperties;
    /**
     * When mergeBehaviour equals union, only show shared properties which exist at least on the specified number of group articles
     *
     * @type {number}
     */
    minGroupPropertyReferenceCount?: number;
    choiceListMergeBehaviour?: ChoiceListMergeBehaviour;
    groupPropertySorting?: PropertySortMode | false;
    /**
     * Sorting function for properties inside of a group
     *
     * @type {PropertySorter}
     */
    sortGroupProperties?: PropertySorter;
}
export declare const buildPropertyGroups: ({ sources, mergeBehaviour, displayMode, createLabel, mergeProperties, choiceListMergeBehaviour, minGroupPropertyReferenceCount, groupPropertySorting, sortGroupProperties, }: BuildOptions) => PropertyGroup[];
export declare const defaultCreateLabel: LabelFactory;
export declare const defaultMergeProperties: (a: IGXE.IProperty, b: IGXE.IProperty, { choiceListMergeBehaviour: choiceListchoiceListMergeBehaviour, }: MergePropertiesSettings) => false | IGXE.IProperty;
export declare const mergeNormalProperties: (a: IGXE.IProperty, b: IGXE.IProperty) => false | IGXE.IProperty;
export declare const mergeChoiceListProperties: (a: IGXE.IProperty, b: IGXE.IProperty, mergeBehaviour: ChoiceListMergeBehaviour) => false | IGXE.IProperty;
export declare const defaultSortProperties: PropertySorter;
