using PanoptesFrontend.Data.Account;
using PanoptesFrontend.Data;
using Microsoft.AspNetCore.Components;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace PanoptesFrontend.Services;

public interface IAccountService
{
    Task Register(AddUser model);
    Task Login(LoginUser model);
    Task Logout(User model);

}

public class AccountService : IAccountService
{
    private IHttpService httpService;

    public AccountService(IHttpService httpService) {
        this.httpService = httpService;
    }


    public async Task Register(AddUser model){
        // endpoint doesnt exist yet
        await httpService.PostAsync("http://localhost:8080/user/register", model);
    }

    public async Task Login(LoginUser model){
        // endpoint doesnt exist yet
        await httpService.PostAsync("http://localhost:8080/user/authenticate", model);
    }

    public async Task Logout(User model){
        // endpoint doesnt exist yet
        await httpService.PostAsync("http://localhost:8080/user/logout", model);
    }
}