using Refit;

namespace NetinaShop.AdminPanel.PWA.Services.RestServices;

public interface ICrudApiRest<T, in TKey> where T : class
{
    [Post("")]
    Task Create<TCreateCommand>([Body] TCreateCommand payload, [Header("Authorization")] string authorization);

    [Get("")]
    Task<List<T>> ReadAll([Query] int page,[Header("Authorization")] string authorization);

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

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

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

}
public interface ICrudDtoApiRest<T, TDto, in TKey> where T : class where TDto : class
{
    [Post("")]
    Task Create([Body] T payload, [Header("Authorization")] string authorization);
    [Post("")]
    Task Create([Body] TDto payload, [Header("Authorization")] string authorization);

    [Get("")]
    Task<List<TDto>> ReadAll([Query]int page);

    [Get("")]
    Task<List<TDto>> ReadAll([Query] int page, [Header("Authorization")] string authorization);


    [Get("")]
    Task<List<TDto>> ReadAll();

    [Get("/{key}")]
    Task<TDto> ReadOne(TKey key);

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

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

}