Yimaru-BackEnd/internal/domain/bet.go

73 lines
1.4 KiB
Go

package domain
type BetOutcome struct {
ID int64
BetID int64
EventID int64
OddID int64
}
type CreateBetOutcome struct {
BetID int64
EventID int64
OddID int64
}
type BetStatus int
const (
BET_STATUS_PENDING BetStatus = iota
BET_STATUS_WIN
BET_STATUS_LOSS
BET_STATUS_ERROR
)
// If it is a ShopBet then UserID will be the cashier
// If it is a DigitalBet then UserID will be the user and the branchID will be 0 or nil
type Bet struct {
ID int64
Amount Currency
TotalOdds float32
Status BetStatus
FullName string
PhoneNumber string
BranchID ValidInt64 // Can Be Nullable
UserID ValidInt64 // Can Be Nullable
IsShopBet bool
CashedOut bool
CashoutID string
}
type GetBet struct {
ID int64
Amount Currency
TotalOdds float32
Status BetStatus
FullName string
PhoneNumber string
BranchID ValidInt64 // Can Be Nullable
UserID ValidInt64 // Can Be Nullable
IsShopBet bool
CashedOut bool
CashoutID string
Outcomes []BetOutcome
}
type CreateBet struct {
Amount Currency
TotalOdds float32
Status BetStatus
FullName string
PhoneNumber string
BranchID ValidInt64 // Can Be Nullable
UserID ValidInt64 // Can Be Nullable
IsShopBet bool
CashoutID string
}
func (b BetStatus) String() string {
return []string{"Pending", "Win", "Loss", "Error"}[b]
}
// func isBetStatusValid()