package com.quinn.service;

import com.quinn.pojo.Source;
import com.baomidou.mybatisplus.extension.service.IService;
import com.quinn.pojo.SourceWithStar;
import com.quinn.vo.MyPageParam;
import com.quinn.vo.QuerySource;
import com.quinn.vo.SourceUpdateForm;
import com.quinn.vo.SourceWriteForm;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.util.List;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author limqsh
 * @since 2022-05-03
 */
public interface SourceService extends IService<Source> {

    /**
     * 下载对应的资源
     * @param response
     * @param source
     * @throws IOException
     */
    void downloadSource(HttpServletResponse response, Source source,String sessionId) throws IOException;

    void downloadForBaidu(HttpServletResponse response, Source source,String sessionId) throws IOException;

    /**
     * 点击对应的资源
     * @throws IOException
     * @return
     */
    Source view(String sid,String sessionId);

    /**
     * 上传新资源
     * @param file
     * @param sourceWriteForm
     */
    void uploadNewSource(MultipartFile file, SourceWriteForm sourceWriteForm) throws IOException;

    /**
     * 更新资源
     * @param file
     * @param sourceUpdateForm
     */
    void updateSource(MultipartFile file, SourceUpdateForm sourceUpdateForm) throws IOException;

    /**
     * 删除资源
     * @param sid
     */
    void deleteSource(String sid);

    List<SourceWithStar> listPageStar(QuerySource querySource, MyPageParam myPageParam);
}
