SimpleCloudNotifier/scnserver/models/enums_gen.go

258 lines
6.4 KiB
Go
Raw Normal View History

2023-06-10 00:15:42 +02:00
// Code generated by enum-generate.go DO NOT EDIT.
2023-04-21 21:45:16 +02:00
package models
import "gogs.mikescher.com/BlackForestBytes/goext/langext"
2023-06-10 00:15:42 +02:00
const ChecksumGenerator = "4bfd61daa179e1452035a34c25c6f8170a08500bc0a7aa0e3981f95ad4b0d7d2"
2023-04-21 21:45:16 +02:00
type Enum interface {
2023-06-10 00:15:42 +02:00
Valid() bool
ValuesAny() []any
ValuesMeta() []EnumMetaValue
VarName() string
2023-04-21 21:45:16 +02:00
}
type StringEnum interface {
2023-06-10 00:15:42 +02:00
Enum
String() string
2023-04-21 21:45:16 +02:00
}
type DescriptionEnum interface {
2023-06-10 00:15:42 +02:00
Enum
Description() string
2023-04-21 21:45:16 +02:00
}
type EnumMetaValue struct {
2023-06-10 00:15:42 +02:00
VarName string `json:"varName"`
Value any `json:"value"`
Description *string `json:"description"`
2023-04-21 21:45:16 +02:00
}
// ================================ ClientType ================================
//
// File: client.go
// StringEnum: true
// DescrEnum: false
//
var __ClientTypeValues = []ClientType{
2023-06-10 00:15:42 +02:00
ClientTypeAndroid,
ClientTypeIOS,
2023-04-21 21:45:16 +02:00
}
var __ClientTypeVarnames = map[ClientType]string{
2023-06-10 00:15:42 +02:00
ClientTypeAndroid: "ClientTypeAndroid",
ClientTypeIOS: "ClientTypeIOS",
2023-04-21 21:45:16 +02:00
}
func (e ClientType) Valid() bool {
2023-06-10 00:15:42 +02:00
return langext.InArray(e, __ClientTypeValues)
2023-04-21 21:45:16 +02:00
}
func (e ClientType) Values() []ClientType {
2023-06-10 00:15:42 +02:00
return __ClientTypeValues
2023-04-21 21:45:16 +02:00
}
func (e ClientType) ValuesAny() []any {
2023-06-10 00:15:42 +02:00
return langext.ArrCastToAny(__ClientTypeValues)
2023-04-21 21:45:16 +02:00
}
func (e ClientType) ValuesMeta() []EnumMetaValue {
2023-06-10 00:15:42 +02:00
return []EnumMetaValue{
EnumMetaValue{VarName: "ClientTypeAndroid", Value: ClientTypeAndroid, Description: nil},
EnumMetaValue{VarName: "ClientTypeIOS", Value: ClientTypeIOS, Description: nil},
}
2023-04-21 21:45:16 +02:00
}
func (e ClientType) String() string {
2023-06-10 00:15:42 +02:00
return string(e)
2023-04-21 21:45:16 +02:00
}
func (e ClientType) VarName() string {
2023-06-10 00:15:42 +02:00
if d, ok := __ClientTypeVarnames[e]; ok {
return d
}
return ""
2023-04-21 21:45:16 +02:00
}
func ParseClientType(vv string) (ClientType, bool) {
2023-06-10 00:15:42 +02:00
for _, ev := range __ClientTypeValues {
if string(ev) == vv {
return ev, true
}
}
return "", false
2023-04-21 21:45:16 +02:00
}
func ClientTypeValues() []ClientType {
2023-06-10 00:15:42 +02:00
return __ClientTypeValues
2023-04-21 21:45:16 +02:00
}
func ClientTypeValuesMeta() []EnumMetaValue {
2023-06-10 00:15:42 +02:00
return []EnumMetaValue{
EnumMetaValue{VarName: "ClientTypeAndroid", Value: ClientTypeAndroid, Description: nil},
EnumMetaValue{VarName: "ClientTypeIOS", Value: ClientTypeIOS, Description: nil},
}
2023-04-21 21:45:16 +02:00
}
// ================================ DeliveryStatus ================================
//
// File: delivery.go
// StringEnum: true
// DescrEnum: false
//
var __DeliveryStatusValues = []DeliveryStatus{
2023-06-10 00:15:42 +02:00
DeliveryStatusRetry,
DeliveryStatusSuccess,
DeliveryStatusFailed,
2023-04-21 21:45:16 +02:00
}
var __DeliveryStatusVarnames = map[DeliveryStatus]string{
2023-06-10 00:15:42 +02:00
DeliveryStatusRetry: "DeliveryStatusRetry",
DeliveryStatusSuccess: "DeliveryStatusSuccess",
DeliveryStatusFailed: "DeliveryStatusFailed",
2023-04-21 21:45:16 +02:00
}
func (e DeliveryStatus) Valid() bool {
2023-06-10 00:15:42 +02:00
return langext.InArray(e, __DeliveryStatusValues)
2023-04-21 21:45:16 +02:00
}
func (e DeliveryStatus) Values() []DeliveryStatus {
2023-06-10 00:15:42 +02:00
return __DeliveryStatusValues
2023-04-21 21:45:16 +02:00
}
func (e DeliveryStatus) ValuesAny() []any {
2023-06-10 00:15:42 +02:00
return langext.ArrCastToAny(__DeliveryStatusValues)
2023-04-21 21:45:16 +02:00
}
func (e DeliveryStatus) ValuesMeta() []EnumMetaValue {
2023-06-10 00:15:42 +02:00
return []EnumMetaValue{
EnumMetaValue{VarName: "DeliveryStatusRetry", Value: DeliveryStatusRetry, Description: nil},
EnumMetaValue{VarName: "DeliveryStatusSuccess", Value: DeliveryStatusSuccess, Description: nil},
EnumMetaValue{VarName: "DeliveryStatusFailed", Value: DeliveryStatusFailed, Description: nil},
}
2023-04-21 21:45:16 +02:00
}
func (e DeliveryStatus) String() string {
2023-06-10 00:15:42 +02:00
return string(e)
2023-04-21 21:45:16 +02:00
}
func (e DeliveryStatus) VarName() string {
2023-06-10 00:15:42 +02:00
if d, ok := __DeliveryStatusVarnames[e]; ok {
return d
}
return ""
2023-04-21 21:45:16 +02:00
}
func ParseDeliveryStatus(vv string) (DeliveryStatus, bool) {
2023-06-10 00:15:42 +02:00
for _, ev := range __DeliveryStatusValues {
if string(ev) == vv {
return ev, true
}
}
return "", false
2023-04-21 21:45:16 +02:00
}
func DeliveryStatusValues() []DeliveryStatus {
2023-06-10 00:15:42 +02:00
return __DeliveryStatusValues
2023-04-21 21:45:16 +02:00
}
func DeliveryStatusValuesMeta() []EnumMetaValue {
2023-06-10 00:15:42 +02:00
return []EnumMetaValue{
EnumMetaValue{VarName: "DeliveryStatusRetry", Value: DeliveryStatusRetry, Description: nil},
EnumMetaValue{VarName: "DeliveryStatusSuccess", Value: DeliveryStatusSuccess, Description: nil},
EnumMetaValue{VarName: "DeliveryStatusFailed", Value: DeliveryStatusFailed, Description: nil},
}
2023-04-21 21:45:16 +02:00
}
// ================================ TokenPerm ================================
//
// File: keytoken.go
// StringEnum: true
2023-05-28 13:39:20 +02:00
// DescrEnum: true
2023-04-21 21:45:16 +02:00
//
var __TokenPermValues = []TokenPerm{
2023-06-10 00:15:42 +02:00
PermAdmin,
PermChannelRead,
PermChannelSend,
PermUserRead,
2023-04-21 21:45:16 +02:00
}
2023-05-28 13:39:20 +02:00
var __TokenPermDescriptions = map[TokenPerm]string{
2023-06-10 00:15:42 +02:00
PermAdmin: "Edit userdata (+ includes all other permissions)",
PermChannelRead: "Read messages",
PermChannelSend: "Send messages",
PermUserRead: "Read userdata",
2023-05-28 13:39:20 +02:00
}
2023-04-21 21:45:16 +02:00
var __TokenPermVarnames = map[TokenPerm]string{
2023-06-10 00:15:42 +02:00
PermAdmin: "PermAdmin",
PermChannelRead: "PermChannelRead",
PermChannelSend: "PermChannelSend",
PermUserRead: "PermUserRead",
2023-04-21 21:45:16 +02:00
}
func (e TokenPerm) Valid() bool {
2023-06-10 00:15:42 +02:00
return langext.InArray(e, __TokenPermValues)
2023-04-21 21:45:16 +02:00
}
func (e TokenPerm) Values() []TokenPerm {
2023-06-10 00:15:42 +02:00
return __TokenPermValues
2023-04-21 21:45:16 +02:00
}
func (e TokenPerm) ValuesAny() []any {
2023-06-10 00:15:42 +02:00
return langext.ArrCastToAny(__TokenPermValues)
2023-04-21 21:45:16 +02:00
}
func (e TokenPerm) ValuesMeta() []EnumMetaValue {
2023-06-10 00:15:42 +02:00
return []EnumMetaValue{
EnumMetaValue{VarName: "PermAdmin", Value: PermAdmin, Description: langext.Ptr("Edit userdata (+ includes all other permissions)")},
EnumMetaValue{VarName: "PermChannelRead", Value: PermChannelRead, Description: langext.Ptr("Read messages")},
EnumMetaValue{VarName: "PermChannelSend", Value: PermChannelSend, Description: langext.Ptr("Send messages")},
EnumMetaValue{VarName: "PermUserRead", Value: PermUserRead, Description: langext.Ptr("Read userdata")},
}
2023-04-21 21:45:16 +02:00
}
func (e TokenPerm) String() string {
2023-06-10 00:15:42 +02:00
return string(e)
2023-04-21 21:45:16 +02:00
}
2023-05-28 13:39:20 +02:00
func (e TokenPerm) Description() string {
2023-06-10 00:15:42 +02:00
if d, ok := __TokenPermDescriptions[e]; ok {
return d
}
return ""
2023-05-28 13:39:20 +02:00
}
2023-04-21 21:45:16 +02:00
func (e TokenPerm) VarName() string {
2023-06-10 00:15:42 +02:00
if d, ok := __TokenPermVarnames[e]; ok {
return d
}
return ""
2023-04-21 21:45:16 +02:00
}
func ParseTokenPerm(vv string) (TokenPerm, bool) {
2023-06-10 00:15:42 +02:00
for _, ev := range __TokenPermValues {
if string(ev) == vv {
return ev, true
}
}
return "", false
2023-04-21 21:45:16 +02:00
}
func TokenPermValues() []TokenPerm {
2023-06-10 00:15:42 +02:00
return __TokenPermValues
2023-04-21 21:45:16 +02:00
}
func TokenPermValuesMeta() []EnumMetaValue {
2023-06-10 00:15:42 +02:00
return []EnumMetaValue{
EnumMetaValue{VarName: "PermAdmin", Value: PermAdmin, Description: langext.Ptr("Edit userdata (+ includes all other permissions)")},
EnumMetaValue{VarName: "PermChannelRead", Value: PermChannelRead, Description: langext.Ptr("Read messages")},
EnumMetaValue{VarName: "PermChannelSend", Value: PermChannelSend, Description: langext.Ptr("Send messages")},
EnumMetaValue{VarName: "PermUserRead", Value: PermUserRead, Description: langext.Ptr("Read userdata")},
}
2023-04-21 21:45:16 +02:00
}