File size: 9,346 Bytes
b0403f2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
"""
Business Value Demonstration
ROI Calculator, Tier Pricing, Upgrade Paths
"""

from typing import Dict, List

class BusinessValueCalculator:
    """Calculates business value and ROI for ARF tiers"""
    
    def __init__(self):
        # Industry benchmarks
        self.benchmarks = {
            "incident_cost": 100000,  # Average incident cost
            "incident_reduction": {
                "oss": 0.0,
                "trial": 0.5,
                "starter": 0.7,
                "professional": 0.85,
                "enterprise": 0.92
            },
            "time_savings_minutes": 15,  # Minutes saved per decision
            "decisions_per_day": 20,
            "engineer_cost_hourly": 150,  # $/hour
            "operating_days": 250,  # Business days per year
            "team_size": {
                "oss": 1,
                "starter": 5,
                "professional": 15,
                "enterprise": 50
            }
        }
        
        # Tier pricing
        self.tier_pricing = {
            "oss": 0,
            "starter": 2000,
            "professional": 5000,
            "enterprise": 15000
        }
        
        # Feature comparison
        self.feature_comparison = {
            "oss": {
                "name": "OSS Edition",
                "price": "$0",
                "enforcement": "Advisory Only",
                "mechanical_gates": "❌ None",
                "approval_workflows": "❌ Manual",
                "audit_trail": "❌ None",
                "support": "Community",
                "sla": "None",
                "best_for": "Evaluation"
            },
            "starter": {
                "name": "Starter",
                "price": "$2,000/mo",
                "enforcement": "Mechanical Gates",
                "mechanical_gates": "✅ 3 Gates",
                "approval_workflows": "✅ Basic",
                "audit_trail": "✅ 30 days",
                "support": "Business Hours",
                "sla": "99.5%",
                "best_for": "Small Teams"
            },
            "professional": {
                "name": "Professional",
                "price": "$5,000/mo",
                "enforcement": "Advanced Gates",
                "mechanical_gates": "✅ 5 Gates",
                "approval_workflows": "✅ Advanced",
                "audit_trail": "✅ 1 year",
                "support": "24/7",
                "sla": "99.9%",
                "best_for": "Growing Companies"
            },
            "enterprise": {
                "name": "Enterprise",
                "price": "$15,000/mo",
                "enforcement": "Full Mechanical",
                "mechanical_gates": "✅ 7 Gates",
                "approval_workflows": "✅ Custom",
                "audit_trail": "✅ Unlimited",
                "support": "Dedicated",
                "sla": "99.99%",
                "best_for": "Enterprise Scale"
            }
        }
    
    def calculate_roi(self, current_tier: str, target_tier: str) -> Dict:
        """Calculate ROI for upgrade"""
        current_price = self.tier_pricing.get(current_tier, 0)
        target_price = self.tier_pricing.get(target_tier, 0)
        
        # Calculate incident cost savings
        current_reduction = self.benchmarks["incident_reduction"].get(current_tier, 0)
        target_reduction = self.benchmarks["incident_reduction"].get(target_tier, 0)
        
        incident_savings = self.benchmarks["incident_cost"] * (target_reduction - current_reduction) * 12
        
        # Calculate time savings
        team_size_current = self.benchmarks["team_size"].get(current_tier, 1)
        team_size_target = self.benchmarks["team_size"].get(target_tier, 1)
        
        avg_team_size = (team_size_current + team_size_target) / 2
        
        time_savings = (
            self.benchmarks["time_savings_minutes"] / 60 *  # Hours per decision
            self.benchmarks["decisions_per_day"] *          # Decisions per day
            self.benchmarks["operating_days"] *            # Days per year
            self.benchmarks["engineer_cost_hourly"] *      # Cost per hour
            avg_team_size                                  # Team size
        )
        
        # Total annual savings
        annual_savings = incident_savings + time_savings
        
        # Calculate ROI
        price_difference = target_price - current_price
        annual_price_difference = price_difference * 12
        
        if annual_savings > 0:
            roi_months = (annual_price_difference / annual_savings) * 12
        else:
            roi_months = 999
        
        # Payback period
        if annual_savings > annual_price_difference:
            payback_months = (annual_price_difference / annual_savings) * 12
        else:
            payback_months = roi_months
        
        return {
            "current_tier": current_tier.upper(),
            "target_tier": target_tier.upper(),
            "annual_savings": f"${annual_savings:,.0f}",
            "incident_savings": f"${incident_savings:,.0f}",
            "time_savings": f"${time_savings:,.0f}",
            "monthly_investment": f"${price_difference:,.0f}",
            "roi_months": f"{roi_months:.1f}",
            "payback_months": f"{payback_months:.1f}",
            "annual_roi": f"{(annual_savings / max(annual_price_difference, 1)) * 100:.0f}%"
        }
    
    def get_tier_comparison(self) -> List[Dict]:
        """Get tier comparison matrix"""
        return [self.feature_comparison[tier] for tier in ["oss", "starter", "professional", "enterprise"]]
    
    def calculate_enterprise_value(self, company_size: int = 100, incidents_per_year: int = 5) -> Dict:
        """Calculate enterprise-specific value"""
        # Incident cost avoidance
        incident_avoidance = incidents_per_year * self.benchmarks["incident_cost"] * self.benchmarks["incident_reduction"]["enterprise"]
        
        # Productivity savings
        productivity_savings = (
            company_size *
            self.benchmarks["time_savings_minutes"] / 60 *
            self.benchmarks["decisions_per_day"] *
            self.benchmarks["operating_days"] *
            self.benchmarks["engineer_cost_hourly"]
        )
        
        # Compliance value (estimated)
        compliance_value = 500000  # Estimated value of compliance automation
        
        total_value = incident_avoidance + productivity_savings + compliance_value
        enterprise_cost = self.tier_pricing["enterprise"] * 12
        
        return {
            "company_size": company_size,
            "incidents_prevented": incidents_per_year * self.benchmarks["incident_reduction"]["enterprise"],
            "incident_avoidance": f"${incident_avoidance:,.0f}",
            "productivity_savings": f"${productivity_savings:,.0f}",
            "compliance_value": f"${compliance_value:,.0f}",
            "total_annual_value": f"${total_value:,.0f}",
            "enterprise_cost": f"${enterprise_cost:,.0f}",
            "value_ratio": f"{total_value / enterprise_cost:.1f}x",
            "monthly_roi": f"${(total_value - enterprise_cost) / 12:,.0f}"
        }
    
    def generate_upgrade_path(self, current_tier: str) -> List[Dict]:
        """Generate upgrade path from current tier"""
        tiers = ["oss", "starter", "professional", "enterprise"]
        
        try:
            current_index = tiers.index(current_tier)
        except ValueError:
            current_index = 0
        
        path = []
        for i in range(current_index + 1, len(tiers)):
            target_tier = tiers[i]
            roi_data = self.calculate_roi(current_tier, target_tier)
            
            path.append({
                "from": self.feature_comparison[current_tier]["name"],
                "to": self.feature_comparison[target_tier]["name"],
                "price_increase": f"${self.tier_pricing[target_tier] - self.tier_pricing[current_tier]:,.0f}/mo",
                "annual_savings": roi_data["annual_savings"],
                "payback_period": roi_data["payback_months"] + " months",
                "key_features": self._get_upgrade_features(current_tier, target_tier)
            })
        
        return path
    
    def _get_upgrade_features(self, from_tier: str, to_tier: str) -> List[str]:
        """Get key features gained in upgrade"""
        features = {
            "oss→starter": [
                "Mechanical gates (3 gates)",
                "Basic approval workflows",
                "30-day audit trail",
                "Business hours support"
            ],
            "starter→professional": [
                "Advanced gates (5 gates)",
                "Custom approval workflows",
                "1-year audit trail",
                "24/7 support",
                "99.9% SLA"
            ],
            "professional→enterprise": [
                "Full mechanical gates (7 gates)",
                "Custom gate development",
                "Unlimited audit trail",
                "Dedicated support engineer",
                "99.99% SLA",
                "On-prem deployment",
                "SOC 2 compliance automation"
            ]
        }
        
        key = f"{from_tier}{to_tier}"
        return features.get(key, ["Enhanced features and support"])