UNPKG

business-as-code

Version:

Primitives for expressing business logic and processes as code

61 lines 1.96 kB
/** * Service definition and management */ import type { ServiceDefinition } from './types.js'; /** * Define a service with pricing, SLA, and delivery information * * @example * ```ts * const service = Service({ * name: 'Widget Consulting', * description: 'Expert widget implementation and optimization', * category: 'Consulting', * targetSegment: 'Enterprise', * valueProposition: 'Get expert help implementing widgets in 2 weeks', * pricingModel: 'fixed', * price: 5000, * currency: 'USD', * deliveryTime: '2 weeks', * sla: { * uptime: 99.9, * responseTime: '< 24 hours', * supportHours: 'Business hours (9-5 EST)', * penalties: '10% refund per day of delay', * }, * }) * ``` */ export declare function Service(definition: ServiceDefinition): ServiceDefinition; /** * Calculate service price based on hours (for hourly pricing) */ export declare function calculateHourlyPrice(service: ServiceDefinition, hours: number): number; /** * Calculate monthly retainer equivalent */ export declare function calculateMonthlyRetainer(service: ServiceDefinition, hoursPerMonth: number): number; /** * Check if service meets SLA uptime requirement */ export declare function checkSLAUptime(service: ServiceDefinition, actualUptime: number): boolean; /** * Parse delivery time to days */ export declare function parseDeliveryTimeToDays(deliveryTime?: string): number; /** * Estimate service completion date */ export declare function estimateCompletionDate(service: ServiceDefinition, startDate?: Date): Date; /** * Calculate service value (for value-based pricing) */ export declare function calculateValueBasedPrice(service: ServiceDefinition, customerValue: number, valueSharePercentage: number): number; /** * Validate service definition */ export declare function validateService(service: ServiceDefinition): { valid: boolean; errors: string[]; }; //# sourceMappingURL=service.d.ts.map