package com.red.circle.other.infra.database.mongo.repository;

import com.red.circle.other.infra.database.mongo.document.AdminTaskRecordDO;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;

import java.time.LocalDate;
import java.util.List;
import java.util.Optional;

/**
 * 管理员任务记录 Repository
 *
 * @author tf
 * @date 2025-11-25
 */
@Repository
public interface AdminTaskRecordRepository extends MongoRepository<AdminTaskRecordDO, String> {

    /**
     * 查询用户指定周期的所有任务
     */
    List<AdminTaskRecordDO> findByUserIdAndCycleStartDate(Long userId, LocalDate cycleStartDate);

    /**
     * 查询用户指定周期的特定任务类型
     */
    Optional<AdminTaskRecordDO> findByUserIdAndTaskTypeAndCycleStartDate(Long userId, String taskType, LocalDate cycleStartDate);

    /**
     * 检查是否存在
     */
    boolean existsByUserIdAndCycleStartDate(Long userId, LocalDate cycleStartDate);
}
