using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using iElection.Models.Config;
using Refit;

namespace iElection.Services.Rest
{
    public interface ICrudApiRest<T, in TKey> where T : class
    {
        [Post("/Create")]
        Task<ApiResult<T>> Create([Body] T payload, [Header("Authorization")] string authorization);

        [Get("/GetAll")]
        Task<ApiResult<List<T>>> ReadAll([Header("Authorization")] string authorization);

        [Get("/GetById/{key}")]
        Task<ApiResult<T>> ReadOne(TKey key, [Header("Authorization")] string authorization);

        [Put("")]
        Task<ApiResult> Update([Body] T payload, [Header("Authorization")] string authorization);

        [Delete("/{key}")]
        Task<ApiResult> Delete(TKey key, [Header("Authorization")] string authorization);

    }
}
