aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Ava/UI/Models/Amiibo.cs
blob: d0ccafd081211971c6ad1f6529bb6e8512b40200 (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
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;

namespace Ryujinx.Ava.UI.Models
{
    public class Amiibo
    {
        public struct AmiiboJson
        {
            [JsonPropertyName("amiibo")] public List<AmiiboApi> Amiibo { get; set; }
            [JsonPropertyName("lastUpdated")] public DateTime LastUpdated { get; set; }
        }

        public struct AmiiboApi
        {
            [JsonPropertyName("name")] public string Name { get; set; }
            [JsonPropertyName("head")] public string Head { get; set; }
            [JsonPropertyName("tail")] public string Tail { get; set; }
            [JsonPropertyName("image")] public string Image { get; set; }
            [JsonPropertyName("amiiboSeries")] public string AmiiboSeries { get; set; }
            [JsonPropertyName("character")] public string Character { get; set; }
            [JsonPropertyName("gameSeries")] public string GameSeries { get; set; }
            [JsonPropertyName("type")] public string Type { get; set; }

            [JsonPropertyName("release")] public Dictionary<string, string> Release { get; set; }

            [JsonPropertyName("gamesSwitch")] public List<AmiiboApiGamesSwitch> GamesSwitch { get; set; }

            public override string ToString()
            {
                return Name;
            }

            public string GetId()
            {
                return Head + Tail;
            }

            public override bool Equals(object obj)
            {
                if (obj is AmiiboApi amiibo)
                {
                    return amiibo.Head + amiibo.Tail == Head + Tail;
                }

                return false;
            }

            public override int GetHashCode()
            {
                return base.GetHashCode();
            }
        }

        public class AmiiboApiGamesSwitch
        {
            [JsonPropertyName("amiiboUsage")] public List<AmiiboApiUsage> AmiiboUsage { get; set; }

            [JsonPropertyName("gameID")] public List<string> GameId { get; set; }

            [JsonPropertyName("gameName")] public string GameName { get; set; }
        }

        public class AmiiboApiUsage
        {
            [JsonPropertyName("Usage")] public string Usage { get; set; }

            [JsonPropertyName("write")] public bool Write { get; set; }
        }
    }
}