using BookReader.Models;
using System.Net;
using static Android.Provider.CallLog;

namespace BookReader.Services;

public interface IDatabaseService
{
    Task InitializeAsync(CancellationToken ct = default);

    // Books
    Task<List<Book>> GetAllBooksAsync(CancellationToken ct = default);
    Task<Book?> GetBookByIdAsync(int id, CancellationToken ct = default);
    Task<int> SaveBookAsync(Book book, CancellationToken ct = default);
    Task<int> UpdateBookAsync(Book book, CancellationToken ct = default);
    Task<int> DeleteBookAsync(Book book, CancellationToken ct = default);

    // Settings
    Task<string?> GetSettingAsync(string key, CancellationToken ct = default);
    Task SetSettingAsync(string key, string value, CancellationToken ct = default);
    Task<Dictionary<string, string>> GetAllSettingsAsync(CancellationToken ct = default);

    // Reading Progress
    Task SaveProgressAsync(ReadingProgress progress, CancellationToken ct = default);
    Task<ReadingProgress?> GetLatestProgressAsync(int bookId, CancellationToken ct = default);
}