using System.Text.Json;
using System.Text.Json.Serialization;
namespace Hokm.Server.Profiles;
public class StatsDto
{
public int Games { get; set; }
public int Wins { get; set; }
public int Losses { get; set; }
public int KotsFor { get; set; }
public int KotsAgainst { get; set; }
public int Tricks { get; set; }
public int BestWinStreak { get; set; }
public int CurrentWinStreak { get; set; }
public int ShutoutWins { get; set; }
public int HakemRounds { get; set; }
public int RoundsWon { get; set; }
}
/// Optional social-media handles a player chooses to share.
public class SocialLinksDto
{
public string? Instagram { get; set; }
public string? Telegram { get; set; }
public string? X { get; set; }
public string? Youtube { get; set; }
}
/// Mirrors the client UserProfile (camelCase JSON).
public class ProfileDto
{
public string Id { get; set; } = "";
public string Username { get; set; } = "";
public string DisplayName { get; set; } = "بازیکن";
public string Avatar { get; set; } = "a-fox";
public string? AvatarImage { get; set; }
public string? Phone { get; set; }
public string? Email { get; set; }
public string Plan { get; set; } = "free";
public long? PlanUntil { get; set; }
public int Level { get; set; } = 1;
public int Xp { get; set; }
public int Coins { get; set; } = 1000;
public int Rating { get; set; } = 1000;
public StatsDto Stats { get; set; } = new();
public List OwnedAvatars { get; set; } = new() { "a-fox", "a-lion" };
public List OwnedCardFronts { get; set; } = new() { "classic" };
public List OwnedCardBacks { get; set; } = new() { "classic" };
public List OwnedTitles { get; set; } = new() { "novice" };
public List OwnedReactionPacks { get; set; } = new();
public List OwnedStickerPacks { get; set; } = new();
public string? Title { get; set; } = "novice";
public string CardFront { get; set; } = "classic";
public string CardBack { get; set; } = "classic";
public Dictionary Achievements { get; set; } = new();
public List Unlocked { get; set; } = new();
public long CreatedAt { get; set; }
// social
public string Gender { get; set; } = ""; // "" | male | female | other
public string? City { get; set; } // selected city id (see client IRAN_CITIES)
public bool CityRewardClaimed { get; set; } // one-time "set your city" reward granted
public SocialLinksDto Socials { get; set; } = new();
public string SocialsVisibility { get; set; } = "public"; // public | friends | hidden
// daily reward streak
public int DailyDay { get; set; } = 1;
public string? DailyLastClaimed { get; set; } // yyyy-MM-dd
}
///
/// Public-facing view of another player (no coins/phone/email). Mirrors the
/// client PublicProfile. Returned by GET /api/profile/{id}/public.
///
public class PublicProfileDto
{
public string Id { get; set; } = "";
public string DisplayName { get; set; } = "";
public string Avatar { get; set; } = "a-fox";
public string? AvatarImage { get; set; }
public string Plan { get; set; } = "free";
public string? Title { get; set; }
public int Level { get; set; } = 1;
public int Rating { get; set; } = 1000;
public StatsDto Stats { get; set; } = new();
public Dictionary Achievements { get; set; } = new();
public List Unlocked { get; set; } = new();
public long CreatedAt { get; set; }
public string Gender { get; set; } = "";
/// Only populated when the viewer is allowed to see them (public / friend / self).
public SocialLinksDto? Socials { get; set; }
public bool IsFriend { get; set; }
public bool IsYou { get; set; }
public bool RequestSent { get; set; }
}
public class MatchSummaryDto
{
public bool Ranked { get; set; }
public int Stake { get; set; }
public bool Won { get; set; }
public bool KotFor { get; set; }
public bool KotAgainst { get; set; }
public int TricksWon { get; set; }
public int Rounds { get; set; }
public bool Shutout { get; set; }
public int HakemRounds { get; set; }
public int RoundsWon { get; set; }
public bool Forfeit { get; set; }
}
public class AchievementUnlockDto
{
public string Id { get; set; } = "";
public string NameFa { get; set; } = "";
public string NameEn { get; set; } = "";
public string Icon { get; set; } = "";
public int CoinReward { get; set; }
}
public class TitleUnlockDto
{
public string Id { get; set; } = "";
public string NameFa { get; set; } = "";
public string NameEn { get; set; } = "";
}
public class RewardResultDto
{
public int RatingBefore { get; set; }
public int RatingAfter { get; set; }
public int RatingDelta { get; set; }
public int CoinsBefore { get; set; }
public int CoinsAfter { get; set; }
public int CoinsDelta { get; set; }
public int XpGained { get; set; }
public int LevelBefore { get; set; }
public int LevelAfter { get; set; }
public bool LeveledUp { get; set; }
public List NewAchievements { get; set; } = new();
public List NewTitles { get; set; } = new();
public bool Promoted { get; set; }
public bool Demoted { get; set; }
}
public class CoinPackDto
{
public string Id { get; set; } = "";
public int Coins { get; set; }
public int Bonus { get; set; }
public int PriceToman { get; set; }
public string? Tag { get; set; }
}
public static class JsonOpts
{
public static readonly JsonSerializerOptions Default = new()
{
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
};
}