mirror of
https://github.com/SamyRai/turash.git
synced 2025-12-26 23:01:33 +00:00
- Complete platform specification and architecture - MVP concept and business model - Technical implementation plans and roadmaps - Financial projections and funding strategy - Brand identity and marketing materials - Mathematical models for resource matching - Competitive analysis and market research - Go-based core models and algorithms Turash guides businesses to optimal resource exchanges, navigating the complex landscape of industrial symbiosis and providing direction to sustainable profitability.
64 lines
2.4 KiB
Go
64 lines
2.4 KiB
Go
package cost
|
||
|
||
import (
|
||
"github.com/damirmukimov/city_resource_graph/models/params"
|
||
"github.com/damirmukimov/city_resource_graph/models/team"
|
||
)
|
||
|
||
// CostBreakdown represents all cost components for a given year.
|
||
type CostBreakdown struct {
|
||
Engineering float64 `json:"engineering"` // Engineering costs (EUR/year)
|
||
Infrastructure float64 `json:"infrastructure"` // Infrastructure costs (EUR/year)
|
||
MarketingSales float64 `json:"marketing_sales"` // Marketing & sales costs (EUR/year)
|
||
Operations float64 `json:"operations"` // Operations costs (EUR/year)
|
||
Total float64 `json:"total"` // Total costs (EUR/year)
|
||
Team team.TeamComposition `json:"team"` // Team composition breakdown
|
||
PersonnelCosts float64 `json:"personnel_costs"` // Total personnel costs (EUR/year)
|
||
}
|
||
|
||
// CalculateCosts computes all cost components for a given year.
|
||
func CalculateCosts(year int, p *params.Params) CostBreakdown {
|
||
cp := p.Costs
|
||
|
||
// Calculate team costs using team structure
|
||
teamComposition := team.GetYearlyTeamComposition(year, p)
|
||
salaries := team.DefaultSalaries()
|
||
personnelCosts := team.CalculateTeamCosts(teamComposition, salaries)
|
||
|
||
// Legacy calculation for backward compatibility
|
||
// Engineering costs = engineers × salary
|
||
engineers := cp.Engineers.GetYear(year)
|
||
engineering := float64(engineers) * cp.EngineerSalary
|
||
|
||
// Use team-based calculation if team structure is available
|
||
// Otherwise fall back to legacy calculation
|
||
if personnelCosts > 0 {
|
||
engineering = personnelCosts
|
||
}
|
||
|
||
// Infrastructure costs (from params)
|
||
infrastructure := cp.Infrastructure.GetYear(year)
|
||
|
||
// Marketing & sales costs (from params)
|
||
// Note: BD/Sales are now included in team costs, but we keep this
|
||
// for backward compatibility with existing params.yaml
|
||
marketingSales := cp.MarketingSales.GetYear(year)
|
||
|
||
// Operations costs (from params)
|
||
// Note: Operations staff are now included in team costs, but we keep this
|
||
// for backward compatibility with existing params.yaml
|
||
operations := cp.Operations.GetYear(year)
|
||
|
||
total := engineering + infrastructure + marketingSales + operations
|
||
|
||
return CostBreakdown{
|
||
Engineering: engineering,
|
||
Infrastructure: infrastructure,
|
||
MarketingSales: marketingSales,
|
||
Operations: operations,
|
||
Total: total,
|
||
Team: teamComposition,
|
||
PersonnelCosts: personnelCosts,
|
||
}
|
||
}
|