using ScadaLink.Commons.Entities.InboundApi;

namespace ScadaLink.Commons.Interfaces.Repositories;

public interface IInboundApiRepository
{
    // ApiKey
    Task<ApiKey?> GetApiKeyByIdAsync(int id, CancellationToken cancellationToken = default);
    Task<IReadOnlyList<ApiKey>> GetAllApiKeysAsync(CancellationToken cancellationToken = default);
    Task<ApiKey?> GetApiKeyByValueAsync(string keyValue, CancellationToken cancellationToken = default);
    Task AddApiKeyAsync(ApiKey apiKey, CancellationToken cancellationToken = default);
    Task UpdateApiKeyAsync(ApiKey apiKey, CancellationToken cancellationToken = default);
    Task DeleteApiKeyAsync(int id, CancellationToken cancellationToken = default);

    // ApiMethod
    Task<ApiMethod?> GetApiMethodByIdAsync(int id, CancellationToken cancellationToken = default);
    Task<IReadOnlyList<ApiMethod>> GetAllApiMethodsAsync(CancellationToken cancellationToken = default);
    Task<ApiMethod?> GetMethodByNameAsync(string name, CancellationToken cancellationToken = default);
    Task<IReadOnlyList<ApiKey>> GetApprovedKeysForMethodAsync(int methodId, CancellationToken cancellationToken = default);
    Task AddApiMethodAsync(ApiMethod method, CancellationToken cancellationToken = default);
    Task UpdateApiMethodAsync(ApiMethod method, CancellationToken cancellationToken = default);
    Task DeleteApiMethodAsync(int id, CancellationToken cancellationToken = default);

    Task<int> SaveChangesAsync(CancellationToken cancellationToken = default);
}
