package domain import ( "time" ) type BetOutcome struct { ID int64 `json:"id" example:"1"` BetID int64 `json:"bet_id" example:"1"` EventID int64 `json:"event_id" example:"1"` OddID int64 `json:"odd_id" example:"1"` SportID int64 `json:"sport_id" example:"1"` HomeTeamName string `json:"home_team_name" example:"Manchester"` AwayTeamName string `json:"away_team_name" example:"Liverpool"` MarketID int64 `json:"market_id" example:"1"` MarketName string `json:"market_name" example:"Fulltime Result"` Odd float32 `json:"odd" example:"1.5"` OddName string `json:"odd_name" example:"1"` OddHeader string `json:"odd_header" example:"1"` OddHandicap string `json:"odd_handicap" example:"1"` Status OutcomeStatus `json:"status" example:"1"` Expires time.Time `json:"expires" example:"2025-04-08T12:00:00Z"` } type CreateBetOutcome struct { BetID int64 `json:"bet_id" example:"1"` EventID int64 `json:"event_id" example:"1"` OddID int64 `json:"odd_id" example:"1"` SportID int64 `json:"sport_id" example:"1"` HomeTeamName string `json:"home_team_name" example:"Manchester"` AwayTeamName string `json:"away_team_name" example:"Liverpool"` MarketID int64 `json:"market_id" example:"1"` MarketName string `json:"market_name" example:"Fulltime Result"` Odd float32 `json:"odd" example:"1.5"` OddName string `json:"odd_name" example:"1"` OddHeader string `json:"odd_header" example:"1"` OddHandicap string `json:"odd_handicap" example:"1"` Expires time.Time `json:"expires" example:"2025-04-08T12:00:00Z"` } // 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 OutcomeStatus FullName string PhoneNumber string BranchID ValidInt64 // Can Be Nullable CompanyID ValidInt64 // Can Be Nullable UserID ValidInt64 // Can Be Nullable IsShopBet bool CashedOut bool CashoutID string CreatedAt time.Time } type BetFilter struct { BranchID ValidInt64 // Can Be Nullable CompanyID ValidInt64 // Can Be Nullable UserID ValidInt64 // Can Be Nullable IsShopBet ValidBool } type GetBet struct { ID int64 Amount Currency TotalOdds float32 Status OutcomeStatus FullName string PhoneNumber string BranchID ValidInt64 // Can Be Nullable CompanyID ValidInt64 // Can Be Nullable UserID ValidInt64 // Can Be Nullable IsShopBet bool CashedOut bool CashoutID string Outcomes []BetOutcome CreatedAt time.Time } type CreateBet struct { Amount Currency TotalOdds float32 Status OutcomeStatus FullName string PhoneNumber string CompanyID ValidInt64 // Can Be Nullable BranchID ValidInt64 // Can Be Nullable UserID ValidInt64 // Can Be Nullable IsShopBet bool CashoutID string OutcomesHash string } type CreateBetOutcomeReq struct { EventID int64 `json:"event_id" example:"1"` OddID int64 `json:"odd_id" example:"1"` MarketID int64 `json:"market_id" example:"1"` } type CreateBetReq struct { Outcomes []CreateBetOutcomeReq `json:"outcomes"` Amount float32 `json:"amount" example:"100.0"` Status OutcomeStatus `json:"status" example:"1"` FullName string `json:"full_name" example:"John"` PhoneNumber string `json:"phone_number" example:"1234567890"` BranchID *int64 `json:"branch_id,omitempty" example:"1"` } type RandomBetReq struct { BranchID int64 `json:"branch_id" validate:"required" example:"1"` NumberOfBets int64 `json:"number_of_bets" validate:"required" example:"1"` } type CreateBetRes struct { ID int64 `json:"id" example:"1"` Amount float32 `json:"amount" example:"100.0"` TotalOdds float32 `json:"total_odds" example:"4.22"` Status OutcomeStatus `json:"status" example:"1"` FullName string `json:"full_name" example:"John"` PhoneNumber string `json:"phone_number" example:"1234567890"` BranchID int64 `json:"branch_id" example:"2"` UserID int64 `json:"user_id" example:"2"` IsShopBet bool `json:"is_shop_bet" example:"false"` CreatedNumber int64 `json:"created_number" example:"2"` CashedID string `json:"cashed_id" example:"21234"` } type BetRes struct { ID int64 `json:"id" example:"1"` Outcomes []BetOutcome `json:"outcomes"` Amount float32 `json:"amount" example:"100.0"` TotalOdds float32 `json:"total_odds" example:"4.22"` Status OutcomeStatus `json:"status" example:"1"` FullName string `json:"full_name" example:"John"` PhoneNumber string `json:"phone_number" example:"1234567890"` BranchID int64 `json:"branch_id" example:"2"` UserID int64 `json:"user_id" example:"2"` IsShopBet bool `json:"is_shop_bet" example:"false"` CashedOut bool `json:"cashed_out" example:"false"` CashedID string `json:"cashed_id" example:"21234"` CreatedAt time.Time `json:"created_at" example:"2025-04-08T12:00:00Z"` } func ConvertCreateBet(bet Bet, createdNumber int64) CreateBetRes { return CreateBetRes{ ID: bet.ID, Amount: bet.Amount.Float32(), TotalOdds: bet.TotalOdds, Status: bet.Status, FullName: bet.FullName, PhoneNumber: bet.PhoneNumber, BranchID: bet.BranchID.Value, UserID: bet.UserID.Value, CreatedNumber: createdNumber, CashedID: bet.CashoutID, } } func ConvertBet(bet GetBet) BetRes { return BetRes{ ID: bet.ID, Amount: bet.Amount.Float32(), TotalOdds: bet.TotalOdds, Status: bet.Status, FullName: bet.FullName, PhoneNumber: bet.PhoneNumber, BranchID: bet.BranchID.Value, UserID: bet.UserID.Value, Outcomes: bet.Outcomes, IsShopBet: bet.IsShopBet, CashedOut: bet.CashedOut, CashedID: bet.CashoutID, CreatedAt: bet.CreatedAt, } }