package top.tqx.demo_1.service;

import top.tqx.demo_1.dto.ImageCreateRequest;
import top.tqx.demo_1.dto.ImageListResponse;
import top.tqx.demo_1.dto.ImageStatsResponse;
import top.tqx.demo_1.dto.ImageUpdateRequest;
import top.tqx.demo_1.entity.Image;

import java.util.List;
import java.util.Map;

public interface ImageService {

    ImageListResponse getImageList(Integer limit, Integer offset);

    byte[] getImage(String imageId);

    ImageStatsResponse getImageStats();

    Image createImage(ImageCreateRequest request);

    Image getImageById(Long id);

    Image updateImage(Long id, ImageUpdateRequest request);

    boolean deleteImage(Long id);

    int batchDeleteImages(List<Long> ids);

    Image getImageByImageId(String imageId);

    boolean existsByImageId(String imageId);

    Image downloadAndSaveImage(String imageId);

    Image downloadAndSaveImageWithMetadata(Map<String, Object> imageMetadata);

    Map<String, Object> getImageInfo(String imageId);

    /**
     * 根据图片ID获取Nginx格式的URL
     * @param imageId 图片ID
     * @return Nginx格式的URL
     */
    String getNginxUrlByImageId(String imageId);

    /**
     * 根据文档名称、页码、片段ID等信息查找图片
     * @param docName 文档名称
     * @param page 页码
     * @param chunkId 片段ID
     * @return 找到的图片列表
     */
    List<Image> findImagesByReference(String docName, Integer page, String chunkId);
}