using Refit;
using Sledgemapper.Shared.Entities;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Sledgemapper
{
    [Headers("Authorization: Bearer")]
    public interface IMapApi
    {
        [Get("/session/{sessionName}")]
        Task<Session> Session(string sessionName);

        [Post("/map/{campaignName}/{sessionName}")]
        Task<bool> NewSession(string campaignName, string sessionName);

        [Post("/session/{sessionName}/snapshot")]
        Task SaveSnapshot([Body] Session session, string sessionName);

        [Post("/session/{sessionName}/tile")]
        Task NewTile([Body] Tile tile, string sessionName);

        [Post("/session/{sessionName}/overlay")]
        Task NewOverlay([Body] Overlay overlay, string sessionName);

        [Post("/session/{sessionName}/note")]
        Task NewNote([Body] Note note, string sessionName);

        [Post("/session/{sessionName}/wall")]
        Task NewWall([Body] Wall overlay, string sessionName);

        [Delete("/session/{sessionName}/wall")]
        Task DeleteWall([Body] Wall wall, string sessionName);

        [Delete("/session/{sessionName}/tile")]
        Task DeleteTile([Body] Tile tile, string sessionName);

        [Delete("/session/{sessionName}/overlay")]
        Task DeleteOverlay([Body] Overlay overlay, string sessionName);

        [Delete("/session/{sessionName}/note")]
        Task DeleteNote([Body] Note overlay, string sessionName);


        public class AuthResult
        {
            public string Token { get; set; }
            public bool Result { get; set; }
            public List<string> Errors { get; set; }
        }

        [Headers("Authorization")]
        [Post("/authmanagement/register")]
        Task<AuthResult> Register([Body] RegisterModel registerModel);

        [Headers("Authorization")]
        [Post("/authmanagement/login")]
        Task<AuthenticateResponse> Authenticate([Body] AuthenticateModel registerModel);

        [Post("/session/{sessionName}/room")]
        Task NewRoom(Room room, string sessionName);

        [Post("/session/{sessionName}/line")]
        Task NewLine(Line line, string sessionName);

        [Post("/campaign/{campaignName}")]
        Task NewCampaign(string campaignName);

        [Get("/campaign/")]
        Task<List<Campaign>> GetCampaigns();

        [Get("/campaign/{campaignName}/players")]
        Task<List<Player>> GetPlayers(string campaignName);

        
        [Get("/campaign/{campaignName}/maps")]
        Task<List<Session>> GetMaps(string campaignName);

        [Post("/campaign/{campaignName}/players/{email}")]
        Task InvitePlayer(string campaignName, string email);
    }
}