import { CriteriaQuery, ORMModel } from "../interfaces/ORMModel"; import ORM from "../interfaces/ORM"; import { IMediaFile } from "./MediaFile"; import Dish from "../models/Dish"; import { WorkTime } from "@webresto/worktime"; import { OptionalAll } from "../interfaces/toolsTS"; export type GetGroupType = { [x: string]: GroupWithAdditionalFields; }; declare let attributes: { /**Id */ id: string; /** ID in external system */ rmsId: string; /** Additional info */ additionalInfo: string; /** */ code: string; description: string; /** Soft deletion */ isDeleted: boolean; /** Dishes group name*/ name: string; seoDescription: string; seoKeywords: string; seoText: string; seoTitle: string; /** Sorting weight */ sortOrder: number; dishes: Dish[]; parentGroup: Group | any; childGroups: Group[] | string[]; recommendations: Group[] | string[]; recommendedBy: Group[] | string[]; /** Icon */ icon: { type: string; allowNull: boolean; }; /** Images */ images: IMediaFile[] | string[]; /** Placeholder for group dishes */ dishesPlaceholder: IMediaFile[]; /** The human easy readable*/ slug: string; /** The concept to which the group belongs */ concept: string; /** The group is displayed*/ visible: boolean; /**A group of modifiers */ modifier: boolean; /** A sign that this is a promo group * The promo group cannot be added from the user. */ promo: boolean; /** Working hours */ worktime: WorkTime[]; customData: { [key: string]: string | boolean | number; } | string; }; interface IVirtualFields { discountAmount?: number; discountType?: "flat" | "percentage"; } type attributes = typeof attributes; /** * @deprecated use `GroupRecord` instead */ interface Group extends OptionalAll, IVirtualFields, ORM { } export interface GroupRecord extends OptionalAll, IVirtualFields, ORM { } declare let Model: { beforeCreate: (init: GroupRecord, cb: (err?: string) => void) => Promise; beforeUpdate: (record: Group, cb: (err?: string) => void) => void; afterUpdate: (record: Group, cb: (err?: string) => void) => void; afterCreate: (record: Group, cb: (err?: string) => void) => void; /** * Returns an object with groups and errors of obtaining these very groups. * @deprecated not used * @param groupsId - array of ID groups that should be obtained * @return Object { * groups: [], * errors: {} * } * where Groups is an array, requested groups with a complete display of investment, that is, with their dishes, the dishes are their modifiers * and pictures, there are pictures of the group, etc., and errors is an object in which the keys are groups that cannot be obtained * According to some dinich, the values of this object are the reasons why the group was not obtained. * @fires group:core:group-get-groups - The result of execution in format {groups: {[groupId]:Group}, errors: {[groupId]: error}} */ getGroups(groupsId: string[]): Promise<{ groups: GroupWithAdditionalFields[]; errors: {}; }>; /** * Returns a group with a given ID * @deprecated not used * @param groupId - ID groups * @return The requested group * @throws The error of obtaining a group * @fires group:core:group-get-groups - The result of execution in the format {Groups: {[Groupid]: Group}, Errors: {[Groupid]: error}} */ getGroup(groupId: string): Promise; /** * Returns a group with a given Slug * @deprecated not used * @param groupSlug - Slug groups * @return The requested group * @throws The error of obtaining a group * @fires group:core:group-get-groups - The result of execution in the format {Groups: {[Groupid]: Group}, Errors: {[Groupid]: error}} */ getGroupBySlug(groupSlug: string): Promise; display(criteria: CriteriaQuery): Promise; getMenuTree(menu?: Group[], option?: "only_ids" | "tree" | "flat_tree"): Promise; /** * Menu for navbar * */ getMenuGroups(concept?: string, topLevelGroupId?: string): Promise; /** * Static method for obtaining recommended dishes by group. * @param {string[]} ids - An array of group IDs. * @param {number} [limit=15] - Optional number of dishes to be returned. * @param {boolean} [includeReverse=false] - Include reverse recommendations. * @returns {Promise} - An array of recommended dishes. */ getRecommendedDishes(ids: string[], limit?: number, includeReverse?: boolean): Promise; /** * Checks whether the group exists, if it does not exist, then creates a new one and returns it. * @param values * @return Updated or created group */ createOrUpdate(values: Group): Promise; }; /** * Describes a group of dishes at the time of obtaining its popularized version, additional fields are the error of the framework */ export interface GroupWithAdditionalFields extends Group { childGroups: Group[]; dishesList: Dish[]; } declare global { const Group: typeof Model & ORMModel; } export {};