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

namespace Ryujinx.UI.Common.Models.Amiibo
{
    public struct AmiiboApi : IEquatable<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 readonly override string ToString()
        {
            return Name;
        }

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

        public readonly bool Equals(AmiiboApi other)
        {
            return Head + Tail == other.Head + other.Tail;
        }

        public readonly override bool Equals(object obj)
        {
            return obj is AmiiboApi other && Equals(other);
        }

        public readonly override int GetHashCode()
        {
            return HashCode.Combine(Head, Tail);
        }

        public static bool operator ==(AmiiboApi left, AmiiboApi right)
        {
            return left.Equals(right);
        }

        public static bool operator !=(AmiiboApi left, AmiiboApi right)
        {
            return !(left == right);
        }
    }
}