using GraphicsManager.Interfaces;
using GraphicsManager.Objects;
using Luski.GUI.MainScreen.UI.LuskiControls;
using Luski.net.Structures.Public;
using Luski.Shared.PublicServers.V1.Enums;
using OpenTK.Mathematics;

namespace Luski.GUI.MainScreen.UI.PublicServers.ServerSettings.Pages.Server.Roles;

public class RoleMember : UserControl
{
    public RoleMember(ServerProfile p, SocketUser u)
    {
        base.Size = new(500.ScaleInt(), 40.ScaleInt());
        Task<IRenderObject> icon = p.MakeRct(u, new(24.ScaleInt()));
        icon.Wait();
        int val = 8.ScaleInt();
        icon.Result.Location = new(val, val);
        Controls.Add(icon.Result);
        LuskiLabel dn = new(Globals.DefaultFont)
        {
            Text = u.ToDisplayString(p)
        };
        Controls.Add(dn);

        dn.Location = new(icon.Result.Location.X + icon.Result.Size.X + 5.ScaleInt(),
            icon.Result.Location.Y + ((icon.Result.Size.Y - dn.Size.Y) / 2));
    }
}