package com.example.myapplication.service;

public class LikeService {
    public static int increment(int current) {
        return current + 1;
    }

    // 新增：使用点赞仓库
    public static boolean addLike(android.content.Context ctx, String userId, long noteId) {
        com.example.myapplication.repository.LikeRepository repo = new com.example.myapplication.repository.LikeRepository(ctx);
        return repo.addLike(userId, noteId);
    }

    public static boolean removeLike(android.content.Context ctx, String userId, long noteId) {
        com.example.myapplication.repository.LikeRepository repo = new com.example.myapplication.repository.LikeRepository(ctx);
        return repo.removeLike(userId, noteId);
    }

    public static boolean hasLiked(android.content.Context ctx, String userId, long noteId) {
        com.example.myapplication.repository.LikeRepository repo = new com.example.myapplication.repository.LikeRepository(ctx);
        return repo.checkUserLikeStatus(userId, noteId);
    }

    public static int likeCount(android.content.Context ctx, long noteId) {
        com.example.myapplication.repository.LikeRepository repo = new com.example.myapplication.repository.LikeRepository(ctx);
        return repo.getLikeCount(noteId);
    }
}