using System.IO;

namespace Crysome.Common.Network.Packets.Client;

public class ClientInfoResponsePacket : IPacket
{
	public string Identifier { get; set; }

	public string Address { get; set; }

	public int Port { get; set; }

	public string Username { get; set; }

	public string ComputerName { get; set; }

	public string OS { get; set; }

	public string ActiveWindow { get; set; }

	public string Uptime { get; set; }

	public string CountryCode { get; set; }

	public string Group { get; set; }

	public string GPU { get; set; }

	public ClientInfoResponsePacket()
	{
	}

	public ClientInfoResponsePacket(string identifier, string address, int port, string username, string computerName, string os, string activeWindow, string uptime, string countryCode, string group, string gpu = "")
	{
		Identifier = identifier;
		Address = address;
		Port = port;
		Username = username;
		ComputerName = computerName;
		OS = os;
		ActiveWindow = activeWindow;
		Uptime = uptime;
		CountryCode = countryCode;
		Group = group;
		GPU = gpu;
	}

	public void Write(BinaryWriter w)
	{
		w.Write(Identifier ?? "");
		w.Write(Address ?? "");
		w.Write(Port);
		w.Write(Username ?? "");
		w.Write(ComputerName ?? "");
		w.Write(OS ?? "");
		w.Write(ActiveWindow ?? "");
		w.Write(Uptime ?? "");
		w.Write(CountryCode ?? "");
		w.Write(Group ?? "");
		w.Write(GPU ?? "");
	}

	public void Read(BinaryReader r)
	{
		Identifier = r.ReadString();
		Address = r.ReadString();
		Port = r.ReadInt32();
		Username = r.ReadString();
		ComputerName = r.ReadString();
		OS = r.ReadString();
		ActiveWindow = r.ReadString();
		Uptime = r.ReadString();
		CountryCode = r.ReadString();
		Group = r.ReadString();
		GPU = r.ReadString();
	}
}
