// Package ironlicensing provides an SDK for software licensing. package ironlicensing import "time" // LicenseStatus represents the status of a license. type LicenseStatus string const ( StatusValid LicenseStatus = "valid" StatusExpired LicenseStatus = "expired" StatusSuspended LicenseStatus = "suspended" StatusRevoked LicenseStatus = "revoked" StatusInvalid LicenseStatus = "invalid" StatusTrial LicenseStatus = "trial" StatusTrialExpired LicenseStatus = "trial_expired" StatusNotActivated LicenseStatus = "not_activated" StatusUnknown LicenseStatus = "unknown" ) // LicenseType represents the type of license. type LicenseType string const ( TypePerpetual LicenseType = "perpetual" TypeSubscription LicenseType = "subscription" TypeTrial LicenseType = "trial" ) // Feature represents a feature in a license. type Feature struct { Key string `json:"key"` Name string `json:"name"` Enabled bool `json:"enabled"` Description string `json:"description,omitempty"` Metadata map[string]any `json:"metadata,omitempty"` } // License represents license information. type License struct { ID string `json:"id"` Key string `json:"key"` Status LicenseStatus `json:"status"` Type LicenseType `json:"type"` Email string `json:"email,omitempty"` Name string `json:"name,omitempty"` Company string `json:"company,omitempty"` Features []Feature `json:"features"` MaxActivations int `json:"maxActivations"` CurrentActivations int `json:"currentActivations"` ExpiresAt *time.Time `json:"expiresAt,omitempty"` CreatedAt time.Time `json:"createdAt"` LastValidatedAt *time.Time `json:"lastValidatedAt,omitempty"` Metadata map[string]any `json:"metadata,omitempty"` } // Activation represents activation information. type Activation struct { ID string `json:"id"` MachineID string `json:"machineId"` MachineName string `json:"machineName,omitempty"` Platform string `json:"platform,omitempty"` ActivatedAt time.Time `json:"activatedAt"` LastSeenAt time.Time `json:"lastSeenAt"` } // LicenseResult represents the result of license validation. type LicenseResult struct { Valid bool `json:"valid"` License *License `json:"license,omitempty"` Activations []Activation `json:"activations,omitempty"` Error string `json:"error,omitempty"` Cached bool `json:"cached,omitempty"` } // CheckoutResult represents the result of checkout. type CheckoutResult struct { Success bool `json:"success"` CheckoutURL string `json:"checkoutUrl,omitempty"` SessionID string `json:"sessionId,omitempty"` Error string `json:"error,omitempty"` } // ProductTier represents a product tier for purchase. type ProductTier struct { ID string `json:"id"` Slug string `json:"slug"` Name string `json:"name"` Description string `json:"description,omitempty"` Price float64 `json:"price"` Currency string `json:"currency"` BillingPeriod string `json:"billingPeriod,omitempty"` Features []Feature `json:"features"` }