aboutsummaryrefslogtreecommitdiffstats
path: root/examples/UserView/UserViewLib/User.cs
blob: e2b0de9be749a9763253f5880095586195998f55 (plain)
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
/***************************************************************************************************
 Copyright (C) 2025 The Qt Company Ltd.
 SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
***************************************************************************************************/

using System.Text.Json.Serialization;

namespace UserViewLib
{
    public record User(
        [property: JsonPropertyName("name")] UserName Name,
        [property: JsonPropertyName("email")] string Email,
        [property: JsonPropertyName("picture")] UserPicture Picture);

    public record UserName(
        [property: JsonPropertyName("first")] string First,
        [property: JsonPropertyName("last")] string Last)
    {
        public string Full => $"{Last}, {First}";
    }

    public record UserPicture(
        [property: JsonPropertyName("thumbnail")] string Thumbnail,
        [property: JsonPropertyName("large")] string Large);
}