1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- package models
- type Plan struct {
- ID string `json:"id"`
- Name string `json:"name"`
- Description string `json:"description"`
- Price int64 `json:"price"`
- Currency string `json:"currency"`
- Specs VMSpecs `json:"specs"`
- }
- type VMSpecs struct {
- CPU int `json:"cpu"`
- RAM int `json:"ram_gb"` // RAM in GB
- Storage int `json:"storage_gb"` // Storage in GB
- Region string `json:"region"`
- }
- const (
- PlanBasic = "basic"
- PlanPro = "pro"
- PlanEnterprise = "enterprise"
- )
- var DefaultPlans = map[string]*Plan{
- PlanBasic: {
- ID: PlanBasic,
- Name: "Basic",
- Description: "Perfect for starting projects",
- Price: 999, // 9.99 EUR
- Currency: "EUR",
- Specs: VMSpecs{
- CPU: 1,
- RAM: 2,
- Storage: 40,
- },
- },
- PlanPro: {
- ID: PlanPro,
- Name: "Professional",
- Price: 2999, // 29.99 EUR
- Currency: "EUR",
- Specs: VMSpecs{
- CPU: 2,
- RAM: 4,
- Storage: 80,
- },
- },
- PlanEnterprise: {
- ID: PlanEnterprise,
- Name: "Enterprise",
- Price: 9999, // 99.99 EUR
- Currency: "EUR",
- Specs: VMSpecs{
- CPU: 4,
- RAM: 16,
- Storage: 160,
- },
- },
- }
- func GetPlan(planID string) (*Plan, bool) {
- plan, exists := DefaultPlans[planID]
- return plan, exists
- }
|