package com.ho.business.service;

import com.ho.business.entity.Picture;
import com.ho.business.vo.req.MesFileReqVo;
import com.ho.business.vo.req.StationPutReqVO;
import com.ho.business.vo.req.StationReq;
import com.ho.business.vo.req.StationReqVO;
import com.ho.business.vo.req.picture.PictureQueryReq;
import com.ho.business.vo.resp.PictureRespVO;
import com.ho.common.tools.entity.UserDetailRespVO;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @Description 图片存储
 * Author yule
 * Date 2023/1/3 14:05
 */
public interface PictureService {
    //新增图片中url
    Picture insertPicture(String url);

    Picture insertPicture(StationReq vo, HttpServletRequest request);

    //添加图片中srcId和type
    void insertSrcIdAndType(StationReqVO vo);
    //删除图片
    void deletedBySrcIdsAndType(List<Integer> srcIds);
    //更新图片
    void updatePicture(StationPutReqVO vo);
    //根据srcId查询图片对象
    List<PictureRespVO> selectBySrcId(Integer srcId);

    Picture selectById(Integer id);

    void deletedById(Integer id);

    /**
     * 查询全部图片
     * @return
     */
    List<Picture> selectAll();

    /**
     * 根据图片id集合删除数据库数据
     * @param picturesIds
     */
    void deletedByIds(List<Integer> picturesIds);

    /**
     * 删除对应的文件信息
     * @param bucket minio桶名称
     * @param groupId 集团id
     * @param pictureId 文件id
     */
    void deletedFile(String bucket,Integer groupId ,Integer pictureId);

    /**
     * 上传文件
     * @param file 文件
     * @param bucket minio桶名称
     */
    Picture uploadFile(MultipartFile file, String version, String updateLog,String ownerOrg,String bucket);

    /**
     * 查询所有上传的文件
     * @return
     */
    List<PictureRespVO> selectAllFile();

    /**
     * 根据条件查询所有上传的文件(srcid,type)
     * @return
     */
    List<Picture> selectAllFileByParam(PictureQueryReq picture);

    List<Picture> selectAllFileByParams(PictureQueryReq picture);

    PictureRespVO selectLastOne(String version);


    Picture selectByStationAndType(Integer id, Integer type);

    /**
     * 插入logo
     * @param LogoPictureId
     * @param stationId
     * @return
     */
    int insertLogo(Integer LogoPictureId,Integer stationId);

    Picture uploadLogoFile(MultipartFile file, String ownerOrg, String bucket);

    /**
     * 上次图片
     * @param file
     * @param user
     * @return
     */
    Picture uploadPicture(MultipartFile file, Integer type, UserDetailRespVO user,Integer isPrivate);

    /**
     * 保存更新文件信息
     * @param picture
     * @return
     */
    Picture saveOrUpdatePicture(Picture picture);


    void deletePicture(Integer pictureId);


    Picture uploadPicture(MultipartFile file, Integer type);

}
