using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;

namespace AudioWallpaper.SSO {
    public class UserInfoSet {
        public string sub { get; set; }
        public bool email_verified { get; set; }
        public string nickname { get; set; }
        public string name { get; set; }
        public string preferred_username { get; set; }
        public string locale { get; set; }
        public string given_name { get; set; }
        public string family_name { get; set; }
        public string email { get; set; }

        public UserInfoSet() { }

        public UserInfoSet(string json) {
            var obj = JsonSerializer.Deserialize<UserInfoSet>(json);
            if (obj != null) {
                sub = obj.sub;
                email_verified = obj.email_verified;
                nickname = obj.nickname?? obj.name;
                name = obj.name;
                preferred_username = obj.preferred_username;
                locale = obj.locale;
                given_name = obj.given_name;
                family_name = obj.family_name;
                email = obj.email;
            }
        }
    }
}
