Files
suaveplan/packages/commerce/booking/booking/src/domains/activities/activities.ts
2026-05-27 23:29:53 +01:00

87 lines
2.9 KiB
TypeScript

/**
* Activity/tour booking domain preset. Factory for tours, classes, and group
* event configurations.
*/
import type { BookingSystemConfig } from "../../types/config.types.js";
import { createBaseConfig } from "../shared.js";
export function createActivityConfig(
tenantId: string,
tenantName: string,
overrides: Partial<BookingSystemConfig> = {}
): BookingSystemConfig {
const base = createBaseConfig(tenantId, tenantName);
return {
...base,
engineRef: {
...base.engineRef,
domainPreset: "activities",
enableWaitlist: true,
},
conflictRef: {
mode: "slot_capacity",
allowSameBoundaryTurnover: false,
bufferDuration: "PT0S",
holdDuration: "PT10M",
capacityMode: "absolute",
},
bookableTypeRegistry: [
{
typeId: "activity",
label: "Activity",
description: "Group activity or tour",
requiredAttributes: [
{
attributeId: "activityTypeId",
label: "Type",
dataType: "string",
enumValues: [],
required: true,
defaultValue: "",
},
{
attributeId: "maxParticipants",
label: "Max Participants",
dataType: "number",
enumValues: [],
required: true,
defaultValue: 20,
},
],
optionalAttributes: [
{
attributeId: "minParticipants",
label: "Min Participants",
dataType: "number",
enumValues: [],
required: false,
defaultValue: 1,
},
{
attributeId: "instructorRef",
label: "Instructor",
dataType: "string",
enumValues: [],
required: false,
defaultValue: "",
},
{
attributeId: "difficultyLevel",
label: "Difficulty",
dataType: "enum",
enumValues: ["beginner", "intermediate", "advanced"],
required: false,
defaultValue: "beginner",
},
],
defaultPricingModel: "per_unit",
defaultConflictMode: "slot_capacity",
supportsLayout: false,
},
],
...overrides,
};
}