mirror of
https://github.com/SamyRai/turash.git
synced 2025-12-26 23:01:33 +00:00
- Initialize git repository - Add comprehensive .gitignore for Go projects - Install golangci-lint v2.6.0 (latest v2) globally - Configure .golangci.yml with appropriate linters and formatters - Fix all formatting issues (gofmt) - Fix all errcheck issues (unchecked errors) - Adjust complexity threshold for validation functions - All checks passing: build, test, vet, lint
43 lines
1.4 KiB
Go
43 lines
1.4 KiB
Go
package cost
|
||
|
||
import (
|
||
"github.com/damirmukimov/city_resource_graph/models/params"
|
||
)
|
||
|
||
// 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)
|
||
}
|
||
|
||
// CalculateCosts computes all cost components for a given year.
|
||
func CalculateCosts(year int, p *params.Params) CostBreakdown {
|
||
cp := p.Costs
|
||
|
||
// Engineering costs = engineers × salary
|
||
engineers := cp.Engineers.GetYear(year)
|
||
engineering := float64(engineers) * cp.EngineerSalary
|
||
|
||
// Infrastructure costs (from params)
|
||
infrastructure := cp.Infrastructure.GetYear(year)
|
||
|
||
// Marketing & sales costs (from params)
|
||
marketingSales := cp.MarketingSales.GetYear(year)
|
||
|
||
// Operations costs (from params)
|
||
operations := cp.Operations.GetYear(year)
|
||
|
||
total := engineering + infrastructure + marketingSales + operations
|
||
|
||
return CostBreakdown{
|
||
Engineering: engineering,
|
||
Infrastructure: infrastructure,
|
||
MarketingSales: marketingSales,
|
||
Operations: operations,
|
||
Total: total,
|
||
}
|
||
}
|