Documentation
¶
Index ¶
- type OrganizationConfig
- func (oc *OrganizationConfig) CalculateMonthlyPrice() float64
- func (oc *OrganizationConfig) DisableService(serviceName string) error
- func (oc *OrganizationConfig) EnableService(serviceName string) error
- func (oc *OrganizationConfig) GetEnabledServices() []string
- func (oc *OrganizationConfig) IsServiceEnabled(serviceName string) bool
- func (oc *OrganizationConfig) Validate() error
- type PricingModel
- type ServicesConfig
- type TemplateType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OrganizationConfig ¶
type OrganizationConfig struct {
ID string `gorm:"type:uuid;primary_key;default:gen_random_uuid()" json:"id"`
OrganizationID string `gorm:"type:uuid;not null;unique" json:"organization_id"`
TemplateType TemplateType `gorm:"type:varchar(50);not null" json:"template_type"`
IsActive bool `gorm:"default:true" json:"is_active"`
// Service configuration
ServicesEnabled ServicesConfig `gorm:"type:jsonb;not null" json:"services_enabled"`
// Template-specific configuration
TemplateConfig map[string]interface{} `gorm:"type:jsonb" json:"template_config"`
// Additional customizations
Customizations map[string]interface{} `gorm:"type:jsonb" json:"customizations"`
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
}
OrganizationConfig represents the configuration for an organization
func NewOrganizationConfig ¶
func NewOrganizationConfig(organizationID string, templateType TemplateType) *OrganizationConfig
NewOrganizationConfig creates a new organization configuration with template defaults
func (*OrganizationConfig) CalculateMonthlyPrice ¶
func (oc *OrganizationConfig) CalculateMonthlyPrice() float64
CalculateMonthlyPrice calculates the monthly price based on enabled services
func (*OrganizationConfig) DisableService ¶
func (oc *OrganizationConfig) DisableService(serviceName string) error
DisableService disables a specific service
func (*OrganizationConfig) EnableService ¶
func (oc *OrganizationConfig) EnableService(serviceName string) error
EnableService enables a specific service
func (*OrganizationConfig) GetEnabledServices ¶
func (oc *OrganizationConfig) GetEnabledServices() []string
GetEnabledServices returns a list of enabled services
func (*OrganizationConfig) IsServiceEnabled ¶
func (oc *OrganizationConfig) IsServiceEnabled(serviceName string) bool
IsServiceEnabled checks if a service is enabled
func (*OrganizationConfig) Validate ¶
func (oc *OrganizationConfig) Validate() error
Validate validates the organization configuration
type PricingModel ¶
type PricingModel struct {
Base float64 `json:"base"`
Services map[string]float64 `json:"services"`
Features map[string]float64 `json:"features"`
Discounts map[TemplateType]float64 `json:"template_discounts"`
}
PricingModel defines the pricing structure for services
func GetPricingModel ¶
func GetPricingModel() *PricingModel
GetPricingModel returns the current pricing model
type ServicesConfig ¶
type ServicesConfig struct {
// Core services (always enabled)
AuthEnabled bool `json:"auth_enabled"`
UserEnabled bool `json:"user_enabled"`
// Optional services
CalendarEnabled bool `json:"calendar_enabled"`
BookingEnabled bool `json:"booking_enabled"`
ChampionshipEnabled bool `json:"championship_enabled"`
MembershipEnabled bool `json:"membership_enabled"`
FacilitiesEnabled bool `json:"facilities_enabled"`
NotificationEnabled bool `json:"notification_enabled"`
PaymentsEnabled bool `json:"payments_enabled"`
// Premium features
GamificationEnabled bool `json:"gamification_enabled"`
WalletEnabled bool `json:"wallet_enabled"`
GroupBookingEnabled bool `json:"group_booking_enabled"`
DynamicPricingEnabled bool `json:"dynamic_pricing_enabled"`
InsightsEnabled bool `json:"insights_enabled"`
}
ServicesConfig defines which services are enabled for an organization
type TemplateType ¶
type TemplateType string
TemplateType represents the organization template types
const ( TEMPLATE_PADEL_ONLY TemplateType = "PADEL_ONLY" TEMPLATE_SOCIAL_CLUB TemplateType = "SOCIAL_CLUB" TEMPLATE_FOOTBALL_CLUB TemplateType = "FOOTBALL_CLUB" TEMPLATE_GYM_FITNESS TemplateType = "GYM_FITNESS" TEMPLATE_CUSTOM TemplateType = "CUSTOM" )