using System.Collections.Generic;
using LitJson;
using UnityEngine;
using Wizard.RoomMatch;

namespace Wizard;

public abstract class UserInfoBase
{
	public int ViewerId { get; private set; }

	public string Name { get; private set; }

	public long EmblemId { get; private set; }

	public string CountryCode { get; private set; }

	public int Rank { get; private set; }

	public int DegreeId { get; private set; }

	public bool? IsFriend { get; private set; }

	public bool? IsFriendRequestSending { get; private set; }

	public bool IsSelf => ViewerId == PlayerStaticData.UserViewerID;

	public UserInfoBase(int viewerId, string name, long emblemId, string country, int rank, int degreeId, bool isFriend)
	{
		ViewerId = viewerId;
		Name = name;
		EmblemId = emblemId;
		CountryCode = country;
		Rank = rank;
		DegreeId = degreeId;
		IsFriend = isFriend;
	}

	public UserInfoBase(JsonData json)
	{
		ViewerId = json["viewer_id"].ToInt();
		Name = json["name"].ToString();
		EmblemId = json["emblem_id"].ToLong();
		CountryCode = json["country_code"].ToString();
		Rank = json["rank"].ToInt();
		DegreeId = json["degree_id"].ToInt();
		if (json.Keys.Contains("is_friend"))
		{
			IsFriend = json["is_friend"].ToBoolean();
		}
		if (json.Keys.Contains("is_friend_apply"))
		{
			IsFriendRequestSending = json["is_friend_apply"].ToBoolean();
		}
	}

	public UserInfoBase(Player player)
	{
		ViewerId = player.ViewerId;
		Name = player.Name;
		EmblemId = player.Emblem;
		CountryCode = player.Country;
		Rank = player.Rank;
		DegreeId = player.Degree;
		IsFriend = player.IsFriend;
	}

	public UserInfoBase(UserFriend friend)
	{
		ViewerId = friend.viewerId;
		Name = friend.name;
		EmblemId = friend.emblemId;
		CountryCode = friend.countryCode;
		Rank = friend.rank;
		DegreeId = friend.degreeId;
		IsFriend = friend.IsFriend;
	}

	public abstract Texture GetUserEmblemTexture();

	public abstract Texture GetUserRankTexture();

	public abstract void InitializeDegreeTexture(UITexture texture);

	public abstract Texture GetUserCountryTexture();

	public abstract List<string> GetUserAssetPathList();
}
