66 lines
1.4 KiB
Go
66 lines
1.4 KiB
Go
package domain
|
|
|
|
import (
|
|
"database/sql/driver"
|
|
"fmt"
|
|
"time"
|
|
)
|
|
|
|
type ReferralStatus string
|
|
|
|
const (
|
|
ReferralPending ReferralStatus = "PENDING"
|
|
ReferralCompleted ReferralStatus = "COMPLETED"
|
|
ReferralExpired ReferralStatus = "EXPIRED"
|
|
ReferralCancelled ReferralStatus = "CANCELLED"
|
|
)
|
|
|
|
func (rs *ReferralStatus) Scan(src interface{}) error {
|
|
switch s := src.(type) {
|
|
case []byte:
|
|
*rs = ReferralStatus(s)
|
|
case string:
|
|
*rs = ReferralStatus(s)
|
|
default:
|
|
return fmt.Errorf("unsupported scan type for ReferralStatus: %T", src)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (rs ReferralStatus) Value() (driver.Value, error) {
|
|
return string(rs), nil
|
|
}
|
|
|
|
type ReferralStats struct {
|
|
TotalReferrals int
|
|
CompletedReferrals int
|
|
TotalRewardEarned float64
|
|
PendingRewards float64
|
|
}
|
|
|
|
type ReferralSettings struct {
|
|
ID int64
|
|
ReferralRewardAmount float64
|
|
CashbackPercentage float64
|
|
BetReferralBonusPercentage float64
|
|
MaxReferrals int32
|
|
ExpiresAfterDays int32
|
|
UpdatedBy string
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
Version int32
|
|
}
|
|
|
|
type Referral struct {
|
|
ID int64
|
|
ReferralCode string
|
|
ReferrerID string
|
|
ReferredID *string
|
|
Status ReferralStatus
|
|
RewardAmount float64
|
|
CashbackAmount float64
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
ExpiresAt time.Time
|
|
}
|