using System.ComponentModel.DataAnnotations.Schema;
namespace KfChatDotNetBot.Models.DbModels;
public class KasinoShopProfileDbModel
{
///
/// ID for the database row
///
public int Id { get; set; }
///
/// Shop profiles belong to a user, not their gambler ID
/// they persist even if the user abandons their profile
///
public required UserDbModel User { get; set; }
///
/// Assets held by this profile
///
public required List Assets { get; set; }
///
/// Loans taken out by this profile
///
[InverseProperty(nameof(KasinoShopProfileLoanDbModel.Borrower))]
public required List LoansTaken { get; set; }
///
/// Loans owed to this profile
///
[InverseProperty(nameof(KasinoShopProfileLoanDbModel.Lender))]
public required List LoansOwed { get; set; }
///
/// State of the profile
///
public required KasinoShopProfileStateFlags State { get; set; } = KasinoShopProfileStateFlags.None;
///
/// JSON object containing data related to the above states
///
public required KasinoShopProfileStateDataModel StateData { get; set; }
///
/// Profile balance in the "Krypto" currency
///
public required decimal KryptoBalance { get; set; }
}
// Note this is serialized to JSON by Entity Framework so you can go wild shoving random bullshit in here
public class KasinoShopProfileStateDataModel
{
///
/// Profile credit score for determining creditworthiness etc.
///
// Actually considered making this uint but I like the idea of negative credit
public required int KreditScore { get; set; }
///
/// Amount this user has wagered towards their sponsor requirement
///
public decimal? SponsorWagerAmount { get; set; } = null;
///
/// The sponsor's wager requirement
///
public decimal? SponsorWagerRequirement { get; set; } = null;
///
/// Modifier that alters the house edge for your gambler entity
///
public required decimal HouseEdgeModifier { get; set; } = 1;
///
/// How much crack you've smoked?
///
public required int CrackCounter { get; set; } = 0;
///
/// How many floor nugs you got embedded in the carpet
///
public required int FloorNugs { get; set; } = 0;
///
/// Time when your weed buff ends
///
public required DateTimeOffset WeedBuffEnds { get; set; } = DateTimeOffset.UtcNow;
///
/// Time when your crack buff ends
///
public required DateTimeOffset CrackBuffEnds { get; set; } = DateTimeOffset.UtcNow;
///
/// Dodgy stat tracking
///
public required KasinoShopStatTrackerModel StatTracker { get; set; } = new();
}
public class KasinoShopStatTrackerModel
{
public decimal TotalDeposited { get; set; } = 0;
public decimal TotalWithdrawn { get; set; } = 0;
public decimal TotalLossback { get; set; } = 0;
///
/// Track wager statistics by game
///
public Dictionary StatTracker { get; set; } = new();
}
public class KasinoShopProfileLoanDbModel
{
///
/// ID for the database row
///
public int Id { get; set; }
///
/// Profile of the user who owns this loan
///
public required KasinoShopProfileDbModel Borrower { get; set; }
///
/// Profile of the user to whom this loan is owed/payable to
///
public required KasinoShopProfileDbModel Lender { get; set; }
///
/// Amount loaned
///
public required decimal Amount { get; set; }
///
/// Amount to be paid out to the loaner
///
public required decimal PayoutAmount { get; set; }
///
/// Date and time loan entry was created
///
public required DateTimeOffset Created { get; set; }
///
/// State of this loan
///
public required LoanState State { get; set; }
}
public class KasinoShopProfileAssetDbModel
{
///
/// ID for the database row
///
public int Id { get; set; }
///
/// Profile of the user who owns this asset
///
public required KasinoShopProfileDbModel Profile { get; set; }
///
/// Value of the item at the time of acquisition in Krypto
///
public required decimal OriginalValue { get; set; }
///
/// What the value of the item is right now
///
public required decimal CurrentValue { get; set; }
///
/// Asset name
///
public required string Name { get; set; }
///
/// Asset type
///
public required AssetType AssetType { get; set; }
///
/// Date and time the asset was acquired
///
public required DateTimeOffset Acquired { get; set; }
///
/// History of value changes (e.g. interest events)
///
public required List ValueChangeReports { get; set; }
///
/// Use this to store enum values for assets that have a subtype (e.g. Car Type)
/// but were otherwise not special enough to have their own table (e.g. Car)
///
public int? AssetSubType { get; set; } = null;
///
/// Serialized JSON for extra information where the schema can't accommodate for you
///
public string? Extra { get; set; } = null;
}
public class KasinoShopProfileAssetInvestmentDbModel
{
///
/// ID for the database row
///
public int Id { get; set; }
///
/// Related asset for this investment
///
public required KasinoShopProfileAssetDbModel Asset { get; set; }
///
/// What type of investment it is
///
public required InvestmentType InvestmentType { get; set; }
///
/// Last time interest was calculated
///
public required DateTimeOffset LastInterestCalculation { get; set; }
///
/// Low point for interest calculations
///
public required float InterestRangeMin { get; set; }
///
/// High point for interest calculations
///
public required float InterestRangeMax { get; set; }
///
/// Use this to store enum values for investments that have a subtype (e.g. Shoe Brand)
/// but were otherwise not special enough to have their own table (e.g. Shoe)
///
public int? InvestmentSubType { get; set; } = null;
///
/// Serialized JSON for extra information where the schema can't accommodate for you
///
public string? Extra { get; set; } = null;
}
public class KasinoShopProfileAssetValueChangeDbModel
{
///
/// ID for the database row
///
public int Id { get; set; }
///
/// Related asset
///
public required KasinoShopProfileAssetDbModel Asset { get; set; }
///
/// Effect of the change
///
public required decimal ValueChangeEffect { get; set; }
///
/// Change percent as a decimal fraction?
///
public required decimal ValueChangePercent { get; set; }
///
/// Descriptive text for the value change (like the source of it)
///
public required string Description { get; set; }
}
[Flags]
public enum KasinoShopProfileStateFlags : ulong
{
None,
IsSponsored,
IsWeeded,
IsCracked,
IsInWithdrawal,
IsLoanable
}
[Flags]
public enum KasinoShopProfileAssetState : ulong
{
None,
///
/// Only applicable to smashable objects (e.g. PC peripherals)
///
IsSmashed
}
public enum AssetType
{
Investment,
Smashable,
Car,
Random
}
public enum InvestmentType
{
Shoes,
Stake,
Gold,
Silver,
Skin,
House,
Random
}
public enum LoanState
{
///
/// Loan not fully paid but borrower still in good standing
///
Active,
///
/// Past due but not yet a serious violation of terms
///
Delinquent,
///
/// Loan terms violated, time to collect
///
Default,
///
/// Loan settled by agreement to amended terms (e.g. paid off less than the full amount)
///
Settled,
///
/// Loan fully repaid for the total amount and closed out
///
Repaid,
///
/// Written off debt due to being unable to collect
///
Uncollectible,
///
/// Administrative state for loans canceled due to serious malfeasance
///
Canceled
}