import { rcEnums } from './rc.enums'; import { AddonRelationType } from './product'; import { OpeningTime } from './facility'; import { ActivityTime } from './seasons'; import { ResourcesToProduct } from './resources-to-products'; import { BasicResource, ResourceObj } from './resources'; import { Membership } from './membership'; export interface IAddon { addonItem: SelectedAddonInterface; events: ResourcesToProduct; handleAddToCart: ( val: number[], obj: SelectedAddonInterface, arr: ResourcesToProduct ) => void; handleRemoveFromCart: (obj: SelectedAddonInterface) => void; } interface addonBaseInterface { id: number; createdAt: string; updatedAt: string; organizationId: number; name: string; quantity: string; paymentProcessorId: number | null; startDate: string; endDate: string; } interface addonPriceInterface extends addonBaseInterface { price: string; currency: string; productId: number; } interface addonProductInterface extends addonBaseInterface { quantity: string; isPublic: boolean; prices: addonPriceInterface[]; currPrice: addonPriceInterface; } interface AddonTime { percentage: number; open: string; close: string; } export interface AvailableAddon { price: number; amount: number; addon: { id: number; name: string; description: string; price: number; status: string; percentage: number; quantity: number; duration: number; addon: boolean; organizationId: number; isMandatory: boolean; isFlexible: boolean; tooltipTitle: string; tooltipSubtitle: string; tooltipBody: string; creatorId: number; creatorType: rcEnums.shared.ResourceNameTypeEnum; userCreatorId: number; ownerId?: number; createdAt: Date; updatedAt: Date; activityTimes: ActivityTime[]; }; } export interface RentalAddOn { spaceId: number; date: string; times: { time: AddonTime; availableAddons: AvailableAddon[]; }[]; } export interface AddonInterface { product: addonProductInterface; relationType: AddonRelationType; spaceId: number; date: string; times?: [ { time: OpeningTime; availableAddons: AvailableAddon[]; } ]; } export interface IPackage { timePeriod: 'event' | 'session' | 'full'; } // a generic way to store addon for both rental and registration export interface SelectedAddonInterface { type: 'addon'; id: number; price: number; name: string; relationType: AddonRelationType; // package in rental, or product in program registration package?: IPackage | unknown; downpayment?: number; timePeriod?: string; quantity?: number; resources?: ResourcesToProduct | (ResourceObj | BasicResource | Membership)[]; duration?: number; }