summary refs log tree commit diff
path: root/extra/admin-api/Models/Spacebar.Models.Generic/User.cs
blob: aa512621ff2948d680ea1817ec5803b33817b6d3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
using System.ComponentModel.DataAnnotations;
using System.Diagnostics;
using System.Text.Json.Nodes;
using System.Text.Json.Serialization;

namespace Spacebar.Models.Generic;

[DebuggerDisplay("{Id} ({Username}#{Discriminator})")]
public class PartialUser
{
    [JsonPropertyName("id"), JsonNumberHandling(JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString)]
    public required long Id { get; set; }

    [JsonPropertyName("username")]
    public string Username { get; set; }

    [JsonPropertyName("discriminator")]
    public string Discriminator { get; set; }

    [JsonPropertyName("global_name")]
    public string? GlobalName { get; set; }

    [JsonPropertyName("avatar")]
    public string? Avatar { get; set; }

    [JsonPropertyName("avatar_decoration_data")]
    public JsonObject? AvatarDecorationData { get; set; }

    [JsonPropertyName("collectibles")]
    public JsonObject? Collectibles { get; set; }

    [JsonPropertyName("display_name_styles"), JsonIgnore(Condition = JsonIgnoreCondition.Never)]
    public DisplayNameStyle? DisplayNameStyles { get; set; }

    [JsonPropertyName("primary_guild")]
    public JsonObject? PrimaryGuild { get; set; }

    [JsonPropertyName("bot")]
    public bool? Bot { get; set; }

    [JsonPropertyName("system")]
    public bool? System { get; set; }

    [JsonPropertyName("banner")]
    public string? Banner { get; set; }

    [JsonPropertyName("accent_color")]
    public int? AccentColor { get; set; }

    [JsonPropertyName("public_flags")]
    public ulong? PublicFlags { get; set; }
}

public class DisplayNameStyle
{
    [JsonPropertyName("font_id")]
    public Font FontId { get; set; } = Font.Default;

    [JsonPropertyName("effect_id")]
    public Effect EffectId { get; set; } = Effect.Solid;

    [JsonPropertyName("colors"), MaxLength(2)]
    public List<int> Colors { get; set; } = [];

    // https://docs.discord.food/resources/user#display-name-font - unsure if these are just really close or directly used by discord while being renamed...
    public enum Font
    {
        Bangers = 1,
        BioRhyme = 2,
        CherryBomb = 3,
        Chicle = 4,
        Compagnon = 5,
        MuseoModerno = 6,
        NeoCastel = 7,
        Pixelify = 8,
        Ribes = 9,
        Sinistre = 10,
        Default = 11,
        ZillaSlab = 12
    }

    public enum Effect
    {
        Solid = 1,
        Gradient = 2,
        Neon = 3,
        Toon = 4,
        Pop = 5, 
        Glow = 6
    }
}