2020-11-06 23:19:54 +03:00
|
|
|
package view
|
|
|
|
|
2022-12-23 15:41:32 +03:00
|
|
|
import (
|
|
|
|
"github.com/muety/wakapi/models"
|
|
|
|
"time"
|
|
|
|
)
|
2020-11-06 23:19:54 +03:00
|
|
|
|
|
|
|
type SettingsViewModel struct {
|
2022-12-23 12:54:56 +03:00
|
|
|
User *models.User
|
|
|
|
LanguageMappings []*models.LanguageMapping
|
|
|
|
Aliases []*SettingsVMCombinedAlias
|
|
|
|
Labels []*SettingsVMCombinedLabel
|
|
|
|
Projects []string
|
|
|
|
SubscriptionPrice string
|
|
|
|
DataRetentionMonths int
|
2022-12-23 15:41:32 +03:00
|
|
|
UserFirstData time.Time
|
2022-12-23 12:54:56 +03:00
|
|
|
SupportContact string
|
|
|
|
ApiKey string
|
|
|
|
Success string
|
|
|
|
Error string
|
2020-11-06 23:19:54 +03:00
|
|
|
}
|
|
|
|
|
2021-01-21 02:26:52 +03:00
|
|
|
type SettingsVMCombinedAlias struct {
|
|
|
|
Key string
|
|
|
|
Type uint8
|
|
|
|
Values []string
|
|
|
|
}
|
|
|
|
|
2021-06-12 11:44:19 +03:00
|
|
|
type SettingsVMCombinedLabel struct {
|
|
|
|
Key string
|
|
|
|
Values []string
|
|
|
|
}
|
|
|
|
|
2022-12-21 01:08:59 +03:00
|
|
|
func (s *SettingsViewModel) SubscriptionsEnabled() bool {
|
|
|
|
return s.SubscriptionPrice != ""
|
|
|
|
}
|
|
|
|
|
2020-11-06 23:19:54 +03:00
|
|
|
func (s *SettingsViewModel) WithSuccess(m string) *SettingsViewModel {
|
|
|
|
s.Success = m
|
|
|
|
return s
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *SettingsViewModel) WithError(m string) *SettingsViewModel {
|
|
|
|
s.Error = m
|
|
|
|
return s
|
|
|
|
}
|