using BookmarkApi.Shared.DTOs;
using BookmarkApi.Shared.DTOs.Bookmark;
using BookmarkApi.Shared.Enums;

namespace BookmarkApi.Core.Interfaces;

/// <summary>
/// 书签服务接口
/// </summary>
public interface IBookmarkService
{
    /// <summary>
    /// 获取用户的书签列表（根据设备可见性过滤）
    /// </summary>
    Task<List<BookmarkDto>> GetUserBookmarksAsync(Guid userId, Guid deviceId, bool isAdminDevice, string? tag = null);

    /// <summary>
    /// 搜索书签
    /// </summary>
    Task<List<BookmarkDto>> SearchBookmarksAsync(Guid userId, Guid deviceId, bool isAdminDevice, string keyword);

    /// <summary>
    /// 获取书签详情
    /// </summary>
    Task<BookmarkDto?> GetBookmarkAsync(Guid bookmarkId, Guid userId, Guid deviceId, bool isAdminDevice);

    /// <summary>
    /// 创建书签
    /// </summary>
    Task<BookmarkDto> CreateBookmarkAsync(Guid userId, CreateBookmarkRequest request);

    /// <summary>
    /// 更新书签
    /// </summary>
    Task<BookmarkDto?> UpdateBookmarkAsync(Guid bookmarkId, Guid userId, UpdateBookmarkRequest request);

    /// <summary>
    /// 删除书签
    /// </summary>
    Task<bool> DeleteBookmarkAsync(Guid bookmarkId, Guid userId);

    /// <summary>
    /// 批量删除书签
    /// </summary>
    Task<int> BatchDeleteBookmarksAsync(Guid userId, Guid[] bookmarkIds);

    /// <summary>
    /// 设置书签可见性
    /// </summary>
    Task<bool> SetVisibilityAsync(Guid bookmarkId, Guid userId, VisibilityType visibility, Guid[]? allowedDevices);

    /// <summary>
    /// 记录访问
    /// </summary>
    Task<bool> RecordVisitAsync(Guid bookmarkId, Guid userId);

    /// <summary>
    /// 更新书签排序
    /// </summary>
    Task<bool> UpdateOrderAsync(Guid bookmarkId, Guid userId, long newOrder);

    /// <summary>
    /// 检查 URL 是否已存在
    /// </summary>
    Task<bool> UrlExistsAsync(Guid userId, string url);

    /// <summary>
    /// 批量导入书签
    /// </summary>
    Task<int> ImportBookmarksAsync(Guid userId, List<CreateBookmarkRequest> bookmarks);

    /// <summary>
    /// 导出书签
    /// </summary>
    Task<List<BookmarkDto>> ExportBookmarksAsync(Guid userId);
}

