
using System.Net;
using VideoConcat.Common.Tools;

namespace VideoConcat.Common.Api.Base
{
    public class SystemApi
    {
        public static async Task<ApiResponse<UserLoginResponse>> LoginAsync<UserLoginResponse>(string username, string password)
        {

            string pcMachineName = Environment.MachineName;
            string pcUserName = Environment.UserName;

            string name = Dns.GetHostName();
            string ipadrlist = Dns.GetHostAddresses(name)?.ToString()??"";

            HttpHelper Http = new();
            ApiResponse<UserLoginResponse> res = await Http.PostAsync<UserLoginResponse>("/api/base/login",
                new
                {
                    Username = username,
                    Password = password,
                    Platform = "pc",
                    PcName = pcMachineName,
                    PcUserName = pcUserName,
                    Ips = ipadrlist
                }
                );

            return res;
        }
    }
}
