Press n or j to go to the next uncovered block, b, p or k for the previous block.
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 | 1x 1x 1x 1x 28x 28x 28x 28x 28x 28x 28x 28x 28x 28x 28x 28x 28x 28x 1x 1x 1x | import roiEstimatesData from "../data/security/roiEstimatesData"; import { SecurityLevel } from "../types/cia"; import { ROIEstimate } from "../types/cia-services"; import { calculateImplementationCost as calculateImplCost, Industry, OrganizationSize, } from "./costCalculationUtils"; import { calculateOverallSecurityLevel, getSecurityLevelValue, } from "./securityLevelUtils"; /** * Interface for representing implementation timeline */ export interface ImplementationTimeline { total: string; phases?: Array<{ name: string; duration: string; }>; } /** * Calculates ROI estimate based on security levels * @param availabilityLevel - Availability security level * @param integrityLevel - Integrity security level * @param confidentialityLevel - Confidentiality security level * @returns ROI estimate object with value and description */ export function calculateROIEstimate( availabilityLevel: SecurityLevel, integrityLevel: SecurityLevel, confidentialityLevel: SecurityLevel ): ROIEstimate { // Calculate overall security level for consistent ROI estimation const securityLevel = calculateOverallSecurityLevel( availabilityLevel, integrityLevel, confidentialityLevel ); // Convert security level to ROI key format (e.g., "Very High" -> "VERY_HIGH") const roiKey = securityLevel .toUpperCase() .replace(" ", "_") as keyof typeof roiEstimatesData; // Return the ROI estimate from the existing data return roiEstimatesData[roiKey] || roiEstimatesData.MODERATE; } /** * Calculates implementation timeline based on security levels * @param availabilityLevel - Availability security level * @param integrityLevel - Integrity security level * @param confidentialityLevel - Confidentiality security level * @returns Implementation timeline object */ export function calculateImplementationTimeline( availabilityLevel: SecurityLevel, integrityLevel: SecurityLevel, confidentialityLevel: SecurityLevel ): ImplementationTimeline { // Get security level values const availabilityValue = getSecurityLevelValue(availabilityLevel); const integrityValue = getSecurityLevelValue(integrityLevel); const confidentialityValue = getSecurityLevelValue(confidentialityLevel); // Calculate total weeks based on security levels const totalWeeks = Math.round( (availabilityValue + integrityValue + confidentialityValue) * 1.5 ); // Calculate phases based on total time return { total: `${totalWeeks} weeks`, phases: [ { name: "Planning", duration: `${Math.round(totalWeeks * 0.3)} weeks`, }, { name: "Implementation", duration: `${Math.round(totalWeeks * 0.5)} weeks`, }, { name: "Testing & Adoption", duration: `${Math.round(totalWeeks * 0.2)} weeks`, }, ], }; } /** * @deprecated Use calculateTotalSecurityCost from costCalculationUtils.ts instead * Estimates implementation cost based on security levels * @param availabilityLevel - Availability security level * @param integrityLevel - Integrity security level * @param confidentialityLevel - Confidentiality security level * @param orgSize - Optional organization size * @param industry - Optional industry * @returns Estimated implementation cost */ export function calculateImplementationCost( availabilityLevel: SecurityLevel, integrityLevel: SecurityLevel, confidentialityLevel: SecurityLevel, orgSize: OrganizationSize = "medium", industry: Industry = "general" ): number { // Redirect to the canonical implementation in costCalculationUtils const availCost = calculateImplCost(availabilityLevel, orgSize, industry); const integCost = calculateImplCost(integrityLevel, orgSize, industry); const confCost = calculateImplCost(confidentialityLevel, orgSize, industry); // Return total CAPEX as implementation cost return availCost.capex + integCost.capex + confCost.capex; } /** * @deprecated Use calculateTotalSecurityCost from costCalculationUtils.ts instead * Estimates operational cost based on security levels * @param availabilityLevel - Availability security level * @param integrityLevel - Integrity security level * @param confidentialityLevel - Confidentiality security level * @param orgSize - Optional organization size * @param industry - Optional industry * @returns Estimated annual operational cost */ export function calculateOperationalCost( availabilityLevel: SecurityLevel, integrityLevel: SecurityLevel, confidentialityLevel: SecurityLevel, orgSize: OrganizationSize = "medium", industry: Industry = "general" ): number { // Redirect to the canonical implementation in costCalculationUtils const availCost = calculateImplCost(availabilityLevel, orgSize, industry); const integCost = calculateImplCost(integrityLevel, orgSize, industry); const confCost = calculateImplCost(confidentialityLevel, orgSize, industry); // Return total OPEX as operational cost return availCost.opex + integCost.opex + confCost.opex; } |