47 lines
1.2 KiB
Go
47 lines
1.2 KiB
Go
|
package models
|
||
|
|
||
|
import (
|
||
|
"codeword/internal/proto/broker"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
type Tariff struct {
|
||
|
ID string `json:"_id"`
|
||
|
Name string `json:"name"`
|
||
|
Price uint64 `json:"price,omitempty"`
|
||
|
IsCustom bool `json:"isCustom"`
|
||
|
Privileges []Privilege `json:"privileges"`
|
||
|
Deleted bool `json:"isDeleted"`
|
||
|
CreatedAt time.Time `json:"createdAt"`
|
||
|
UpdatedAt time.Time `json:"updatedAt"`
|
||
|
DeletedAt *time.Time `json:"deletedAt,omitempty"`
|
||
|
}
|
||
|
|
||
|
type Privilege struct {
|
||
|
ID string `json:"_id"`
|
||
|
Name string `json:"name"`
|
||
|
PrivilegeID string `json:"privilegeId"`
|
||
|
ServiceKey string `json:"serviceKey"`
|
||
|
Description string `json:"description"`
|
||
|
Amount uint64 `json:"amount"`
|
||
|
Type PrivilegeType `json:"type"`
|
||
|
Value string `json:"value"`
|
||
|
Price uint64 `json:"price"`
|
||
|
}
|
||
|
|
||
|
type PrivilegeType string
|
||
|
|
||
|
const (
|
||
|
PrivilegeTypeCount = "count"
|
||
|
PrivilegeTypeDay = "day"
|
||
|
PrivilegeTypeFull = "full"
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
PrivilegeBrokerTypeMap = map[PrivilegeType]broker.PrivilegeType{
|
||
|
PrivilegeTypeFull: broker.PrivilegeType_Full,
|
||
|
PrivilegeTypeDay: broker.PrivilegeType_Day,
|
||
|
PrivilegeTypeCount: broker.PrivilegeType_Count,
|
||
|
}
|
||
|
)
|