using System.ComponentModel; namespace KfChatDotNetBot.Models.DbModels; public class GamblerDbModel { /// /// ID fo the database row /// public int Id { get; set; } /// /// User that this gambler entity is associated with. /// A user can have multiple associated gambler entities, but only one should be active /// public required UserDbModel User { get; set; } /// /// Gambler's balance. It can be negative if an admin has forced them into an overdraft /// Values are fractional, it is NOT stored as cents, therefore 100.00 KKK is stored as "100" in the database /// public required decimal Balance { get; set; } /// /// What state the gambler entity is in /// public required GamblerState State { get; set; } = GamblerState.Active; /// /// The seed value given to any instance of Random that's associated with the gambler /// public required string RandomSeed { get; set; } /// /// When the gambler entity was created /// public required DateTimeOffset Created { get; set; } } public class TransactionDbModel { /// /// ID fo the database row /// public int Id { get; set; } /// /// User whose balance was affected by this transaction /// public required GamblerDbModel User { get; set; } /// /// Source of the transaction event /// public required TransactionSourceEventType EventSource { get; set; } /// /// Time when the event occurred /// public required DateTimeOffset Time { get; set; } /// /// Effect of the transaction, plus or minus /// public required decimal Effect { get; set; } /// /// Optional descriptive comment for the transaction. e.g. "Win from wager [id]", "Balance adjustment by Avenue", "Juicer from Null", etc. /// public string? Comment { get; set; } = null; /// /// Sender of the transaction in the case of a juicer, null otherwise /// public GamblerDbModel? From { get; set; } = null; } public class WagerDbModel { /// /// ID fo the database row /// public int Id { get; set; } /// /// User who wagered /// public required GamblerDbModel User { get; set; } /// /// Time they wagered /// public required DateTimeOffset Time { get; set; } /// /// Amount the user wagered /// public required decimal WagerAmount { get; set; } /// /// Effect of the wager on the user's balance /// public required decimal WagerEffect { get; set; } /// /// Game they played to wager the amount (Note: enum must be extended for any new games. /// Don't remove games which are legacy from the enum, just give them the Obsolete attribute) /// public required WagerGame Game { get; set; } /// /// Multiplier if applicable. 0 if it was a complete loss /// public required decimal Multiplier { get; set; } /// /// An optional field to store serialized information about the game that was played /// public string? GameMeta { get; set; } = null; } /// /// What event triggered this transaction /// public enum TransactionSourceEventType { /// /// Generic catch-all type if nothing else suits /// Other, /// /// Juice from another user. This is only for person to person transactions, use Bonus for kasino rewards /// Juicer, /// /// Transaction generated from the result of a wager /// Gambling, /// /// For recording events related to an administrative action. e.g. balance adjustments /// Administrative, /// /// Some type of bonus, like rakeback or a reload. Do not use for hostess rewards /// Bonus, /// /// Use this only for hostess juicers as the sum of these juicers in a given day can influence the hostess' behavior /// Hostess } public enum WagerGame { Limbo, Dice, Mines, Planes, [Description("Lambchop")] LambChop, Keno, [Description("Coinflip")] CoinFlip } public enum GamblerState { /// /// Gambler entity is active and user can wager using the profile /// Active, /// /// Gambler entity has been disabled by an administrator (e.g. due to cheating) /// The user will get a new gambler entity when they next interact with the kasino /// AdministrativelyDisabled, /// /// Gambler entity that was abandoned by the user (e.g. to escape an exclusion or crippling debt) /// Abandoned, /// /// Entity was permanently banned. This will prevent future gambler entities being created for this user /// and will effectively lock them out of the game entirely /// PermanentlyBanned }