import { vec3 } from "@intelligentgraphics/ig.gfx.core";
import * as IGXE from "./IGXE";
/**
 * Interface description for the standardized BOM format, named IGXB.
 * Versions:
 *
 * 1.0 - Initial version, still work in progress!
 */
export interface IGXB_Object {
    /** Format version, Major.Minor */
    FormatVersion: string;
    /** Ordered list of items */
    Items: TItems;
    /** Optional header calculation */
    HeaderCalculation?: TAdditionalPrices;
    /** Price type */
    PriceType: EPriceType;
    /** If PriceType is "Gross", specify used VAT in percent. */
    VAT?: number;
    /** Standard project data. */
    ProjectData: IProjectData;
    /** Custom project data. */
    CustomData: {
        [applicationId: string]: any;
    };
}
/** Current format version, major tag, increase on major and/or incompatible
 * changes (and write a converter) */
export declare const CurrentMajorVersion = 1;
/** Current format version, minor tag, increase on any changes. */
export declare const CurrentMinorVersion = 1;
/** Project-specific data to be inserted into/updated with each
 * project (step). */
export interface IProjectData {
    /** The (globally) unique project id. Should be a Guid or so. */
    Id: string;
    /** The project title. */
    Title: string;
    /** An optional additional description/comments. */
    Description?: string;
    /** Initial creation time (and date), never to be changed!
     * String representation of a JS date-time object.
     */
    Creation: string;
    /** Time (and date) of last modification after initial creation.
     * String representation of a JS date-time object.
     */
    Modification?: string;
    /** The project author's id, specific to a given back end */
    AuthorId?: string;
    /** The project author's name. */
    AuthorName?: string;
    /** The project author's email. */
    AuthorEmail?: string;
}
/** Data type for BOM items at root-level */
export declare type TItems = TAnyItem[];
/** Data type for BOM items at sub-level */
export declare type TSubItems = (ITextItem | IArticleItem)[];
/** Texts may be a single line or an array of lines. Don't include HTML
 *  Tags or other markup in them. */
export declare type TTextEntry = string | string[];
/** Enum for item type IDs */
export declare enum EItemType {
    Group = 0,
    Text = 1,
    Article = 2,
    Impression = 3,
    Set = 4,
    HeadData = 5
}
export declare type TAnyItem = IItemGroup | ITextItem | IArticleItem | IImpressionItem | ISetItem | IHeadDataItem;
export declare type TArticleLikeItem = IArticleItem | IImpressionItem | ISetItem | IHeadDataItem;
/** Basic Item structure. Objects can be casted as IItemGroup, ITextItem,
 *  IArticleItem based on ItemType */
export interface IBaseItem {
    /** Item Type */
    ItemType: EItemType;
    /** Unique ID to be generated by a BOM-managing class after inserting into BOM */
    UID: string;
    /**
     * Controls wether an item and its subitems should be visible
     *
     * @type {boolean}
     */
    Hidden?: boolean;
}
/** A group of items. Groups don't interrupt the position numbering and
 *  may be visualized by a collapsible list control. Subtotals can also
 *  be calculated.
 */
export interface IItemGroup extends IBaseItem {
    ItemType: EItemType.Group;
    /** */
    Caption?: TTextEntry;
    /** */
    Items: TSubItems;
    Identifier?: string;
}
/** Text-only item for informational purposes. */
export interface ITextItem extends IBaseItem {
    ItemType: EItemType.Text;
    /** The text to be displayed to the user */
    Text: TTextEntry;
    /** Optional flag to mark the text as important (to be formatted in bold or something) */
    Important?: boolean;
    /** Custom attribute for project specific data */
    Data?: any;
}
export interface IHeadDataItem extends IBaseItem {
    ComId: string;
    Configuration: IGXE.IArticleConfiguration;
    Source: string;
    /** Article number */
    ArticleId: string;
    /** ArticlePackageId */
    ArticlePackageId?: string;
    /** Article variant code */
    ArticleVarCode?: string;
    ItemType: EItemType.HeadData;
    Categories?: object;
}
export interface IBaseArticleItem extends IBaseItem {
    /** Manufacturer ID */
    ManufacturerId: string;
    /** Program ID */
    ProgramId: string;
    /** Manufacturer Name */
    ManufacturerName: string;
    /** Program Name */
    ProgramName: string;
    /** Article number */
    ArticleId: string;
    ArticleNumber?: any;
    ArticleName?: string;
    /** ArticlePackageId */
    ArticlePackageId?: string;
    /** Article (short) text. Use this field, if you have just one kind of article text. */
    ArticleShortText: TTextEntry;
    /** Article long text */
    ArticleLongText?: TTextEntry;
    /** Article variant text */
    ArticleVarText?: TVarText;
    /** Article variant code */
    ArticleVarCode?: string;
    /** Article custom (user-defined) text */
    ArticleCustomText?: TTextEntry;
    /** Is this an alternative position? (defaults to false) */
    IsAlternative?: boolean;
    /** Quantity (defaults to 1.0) */
    Quantity?: number;
    /** Unit (defaults to "" which mostly means "Pieces") */
    Unit?: string;
    /** Set this to false to ignore the item on all commercially relevant outputs, like
     * order lists. This flag is true when unspecified. It should be set to false on items
     * like walls or decoration. */
    IsCommercial: boolean;
    /** Price of a single unit as it comes from product data */
    SinglePrice?: number;
    /**
     * Formatted price with unit
     */
    SinglePriceText?: string;
    /** Additional prices of a single unit as it comes from product data (like surcharge for a specific color) */
    AdditionalPrices?: TAdditionalPrices;
    /** Additional prices of a single unit as defined by the user */
    CustomPrices?: TAdditionalPrices;
    /** Currency as ISO-4217 string (like "EUR", "USD"). Must be given if SinglePrice is given. */
    Currency?: string;
    /** Commercial instance id for synchronizing BOM entry with product data */
    ComId: string;
    /** Id for electronic data interfaces e.g. pin to read from
     *  server, or ediData-Object to create LINE/MASS/SAME for this item */
    EdiId?: string;
    /** Product data source, useful when using multiple product data sources.
     * can correspond to "<ManufacturerId>.<CatalogId>" of IGXR, i.e.
     */
    Source: string;
    /** Article Image either as URI or Base64 encoded */
    Image?: string;
    /** IGD.ProductData.IArticleConfiguration for restoration */
    Configuration?: IGXE.IArticleConfiguration;
    Categories?: object;
    /** Custom attribute for project specific data */
    Data: IArticleData;
}
/** Article item. */
export interface IArticleItem extends IBaseArticleItem {
    ItemType: EItemType.Article;
    /** Id for synchronizing BOM entry with a graphic representation */
    GfxId?: string;
    /** List of sub-items */
    SubItems?: TSubItems;
    /** The position in the World
     * Values must be specified in Meter.
     */
    Position?: vec3;
    /** The rotation in the World
     * Values must be specified in Degrees.
     */
    Rotation?: vec3;
}
export interface IArticleData {
    /**
     * Specifies wether an article can be configured by itself or only through the set
     *
     * @type {boolean}
     */
    onlyWithSetConfigurable?: boolean;
    /**
     * Specifies wether an article can be moved by itself or only through the set
     *
     * @type {boolean}
     */
    onlyWithSetManipulable?: boolean;
    /**
     * Specifies wether an article can be removed by itself or only through the set
     *
     * @type {boolean}
     */
    onlyWithSetRemovable?: boolean;
    setId?: string;
    setPrimary?: boolean;
    [key: string]: any;
}
export interface IImpressionItem extends IBaseArticleItem {
    ItemType: EItemType.Impression;
}
export interface ISetItem extends IBaseItem {
    ComId: string;
    ItemType: EItemType.Set;
    Items: IArticleItem[];
    Caption?: TTextEntry;
    Source: string;
    SetId: string;
    Configuration: IGXE.IArticleConfiguration;
    /** Price of a single unit as it comes from product data */
    SinglePrice?: number;
    /**
     * Formatted price with unit
     */
    SinglePriceText?: string;
    /** Currency as ISO-4217 string (like "EUR", "USD"). Must be given if SinglePrice is given. */
    Currency?: string;
    Categories?: object;
}
/** Data type for variant text entries */
export declare type TVarText = IVarTextEntry[];
/** Variant text entry format */
export interface IVarTextEntry {
    key: string;
    value: string;
}
/** Data type for additional prices on article or header level */
export declare type TAdditionalPrices = IAdditionalPrice[];
/** Enumeration of calculation rules for additional prices */
export declare enum EAddPriceRule {
    /** If currency is %, calculate absolute value on base price */
    ToBase = 0,
    /** If currency is %, calculate absolute value on the sum of base price
     * and all additional prices so far */
    ToSum = 1
}
/** Format for an additional price (discout or surcharge, absolute or percentage) */
export interface IAdditionalPrice extends IPrice {
    /** Description of the price entry */
    Text: TTextEntry;
    /** Rule for adding relative prices. Must be given if Currency is "%". */
    Level?: EAddPriceRule;
}
export interface IPrice {
    /** Value. Positive for surcharges, negative for discounts */
    Value?: number;
    RangeMin?: number;
    RangeMax?: number;
    /** Currency as ISO-4217 string (like "EUR", "USD") or "%" for relative prices. */
    Currency?: string;
}
/** Enumeration of price types used in this BOM */
export declare enum EPriceType {
    /** BOM includes no prices */
    None = 0,
    /** BOM includes net prices (without VAT) */
    Net = 1,
    /** BOM includes gross prices (with VAT). Specify used VAT in defined field! */
    Gross = 2
}
/**
 * Traverses the item tree and executes the callback for every decendant as well as item of the initial array
 *
 * @param {TItems} items
 * @param {(item: TAnyItem) => void} cb
 */
export declare const traverse: (items: TAnyItem[], cb: (item: TAnyItem) => void) => void;
