UNPKG

@aptly-as/types

Version:
127 lines (126 loc) 5.28 kB
import { AptlyAlgorithmSchema } from './algorithm.js'; import { AptlyBaseSchema, AptlyHistorySchema } from './extends.js'; import { AptlyCategorySectionDisplayType, AptlyUnitTemplateCategorySectionProductMeasureUnitType, AptlyUnitTemplateCategorySectionProductParamKey } from '../enums/index.js'; import { AptlyPeriodSchema } from './period.js'; import { AptlyProductSchema } from './product.js'; import { AptlyProducerSchema } from './producer.js'; import { AptlyMediaSrcSchema } from './media.js'; import { AptlyUpsellTemplateSchema } from './upsell-template.js'; export type AptlyUnitTemplateBase = AptlyUnitTemplateBaseSchema<string, string>; export interface AptlyUnitTemplateBaseSchema<ID, DATE> extends AptlyBaseSchema<ID, DATE> { _order_categories: ID[]; categories: AptlyUnitTemplateCategorySchema<ID, DATE>[]; } export type AptlyUnitTemplate = AptlyUnitTemplateSchema<string, string>; export interface AptlyUnitTemplateSchema<ID, DATE> extends AptlyUnitTemplateBaseSchema<ID, DATE>, AptlyHistorySchema<ID, DATE> { name: string; description?: string; organization?: ID; project?: ID; unit?: ID; copiedFrom?: ID; blueprints: AptlyUnitTemplateBlueprintSchema<ID>[]; } export type AptlyUnitTemplateBlueprint = AptlyUnitTemplateBlueprintSchema<string>; export interface AptlyUnitTemplateBlueprintSchema<ID> { _id: ID; image: string; featured: boolean; } export type AptlyUnitTemplateCategory = AptlyUnitTemplateCategorySchema<string, string>; export interface AptlyUnitTemplateCategorySchema<ID, DATE> { _id: ID; _orderID: ID; name: string; text?: string; isRoom: boolean; category?: ID; size?: number; upsellTemplate?: AptlyUpsellTemplateSchema<ID, DATE> | ID | null; _order_sections: ID[]; sections: AptlyUnitTemplateCategorySectionSchema<ID, DATE>[]; sameAs?: ID; } export type AptlyUnitTemplateCategorySection = AptlyUnitTemplateCategorySectionSchema<string, string>; export interface AptlyUnitTemplateCategorySectionSchema<ID, DATE> { _id: ID; _orderID: ID; name: string; text?: string; description?: string; standard?: boolean; multiSelect: boolean; displayType: AptlyCategorySectionDisplayType; packages: AptlyUnitTemplateCategorySectionPackageSchema<ID, DATE>[]; assortments?: AptlyUnitTemplateCategorySectionAssortmentSchema<ID, DATE>[]; _order_products: ID[]; products: AptlyUnitTemplateCategorySectionProductSchema<ID, DATE>[]; period: AptlyPeriodSchema<ID, DATE> | ID; } export type AptlyUnitTemplateCategorySectionPackage = AptlyUnitTemplateCategorySectionPackageSchema<string, string>; export interface AptlyUnitTemplateCategorySectionPackageSchema<ID, DATE> { _id: ID; name: string; standard: boolean; image?: string | null; imageMedia?: AptlyMediaSrcSchema<ID, DATE> | null; description?: string; _product_order?: ID[]; products?: AptlyUnitTemplateCategorySectionProductSchema<ID, DATE>[]; assortments?: AptlyUnitTemplateCategorySectionAssortmentSchema<ID, DATE>[]; } export type AptlyUnitTemplateCategorySectionAssortment = AptlyUnitTemplateCategorySectionAssortmentSchema<string, string>; export interface AptlyUnitTemplateCategorySectionAssortmentSchema<ID, DATE> extends Pick<AptlyBaseSchema<ID, DATE>, '_id' | 'createdAt' | 'updatedAt'> { color: string; package?: ID | null; } export type AptlyUnitTemplateCategorySectionProduct = AptlyUnitTemplateCategorySectionProductSchema<string, string>; export interface AptlyUnitTemplateCategorySectionProductSchema<ID, DATE> { _id: ID; _orderID: ID; product?: AptlyProductSchema<ID, DATE>; producer?: AptlyProducerSchema<ID, DATE>; availableProducts: ID[]; variantPrices: AptlyUnitTemplateCategorySectionProductVariantPriceSchema<ID>[]; text?: string; unitSizeRoom?: string; unitSizeParam?: string; unitCostRoom?: string; unitCostParam?: string; consequenceRoom?: string; consequenceParam?: string; amount: number; unitCost?: number; unitVat?: number; algorithm: ID | AptlyAlgorithmSchema<ID> | null; standard: boolean; standardVariant?: ID; partOfPackage?: ID; partOfAssortment?: ID; supplier?: ID | null; customTitle?: string; customDescription?: string; notifyWhenPicked?: boolean; onlyShowInSelection?: boolean; recommendation?: ID | null; labels?: ID[]; params: AptlyUnitTemplateCategorySectionProductParamSchema<ID>[]; measureUnitType: AptlyUnitTemplateCategorySectionProductMeasureUnitType; pick?: any; } export type AptlyUnitTemplateCategorySectionProductParam<VALUE> = AptlyUnitTemplateCategorySectionProductParamSchema<string, VALUE>; export interface AptlyUnitTemplateCategorySectionProductParamSchema<ID, VALUE = any> { _id: ID; key: AptlyUnitTemplateCategorySectionProductParamKey; value: VALUE; categoryName?: string; sectionNames?: string[]; sectionName?: string; } export type AptlyUnitTemplateCategorySectionProductVariantPrice = AptlyUnitTemplateCategorySectionProductVariantPriceSchema<string>; export interface AptlyUnitTemplateCategorySectionProductVariantPriceSchema<ID> { variant: ID; price: number; baseCost?: number; labels?: ID[]; }