using AbrBlazorTools;
using Microsoft.AspNetCore.Components;
using Models.Identity;
using Newtonsoft.Json;

namespace ApiUtils;

public class UserUtils : IUserUtils
{
    private readonly IHttpClientWithLoginToken _client;

    public  UserUtils(IHttpClientWithLoginToken client)
    {
        _client = client;
    }

  

    public async Task<HttpResponseMessage> SendSignUpRequest(object accountModel)
    {
        return await _client.HttpPost("/api/AUTH/SignUp",accountModel);

    }
    public async Task<HttpResponseMessage> LoginWithPasswordRequest(object loginModel)
    {
        return await _client.HttpPost("/api/AUTH/Login",loginModel);
    }
    public async Task<HttpResponseMessage> CheckLogin(bool goToLogin = true)
    {
        return await _client.HttpGet("/api/AUTH/Check",true,goToLogin);
    }




}


public interface IUserUtils
{
    Task<HttpResponseMessage> LoginWithPasswordRequest(object loginModel);
    Task<HttpResponseMessage> SendSignUpRequest(object accountModel);
    Task<HttpResponseMessage> CheckLogin(bool goToLogin = true);



}