package de.assecutor.votianlt.repository;

import de.assecutor.votianlt.model.Photo;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Repository interface for Photo entities. Provides database operations for the
 * photos collection.
 */
@Repository
public interface PhotoRepository extends MongoRepository<Photo, ObjectId> {
    /**
     * Find all photos associated with a specific task ID.
     * 
     * @param taskId
     *            The ObjectId of the task
     * @return List of photos for the task
     */
    List<Photo> findByTaskId(ObjectId taskId);

    /**
     * Find photos by task ID as string.
     * 
     * @param taskId
     *            The task ID as string
     * @return List of photos for the task
     */
    default List<Photo> findByTaskId(String taskId) {
        return findByTaskId(new ObjectId(taskId));
    }
}