package com.fs.course.service;

import com.fs.common.core.domain.R;
import com.fs.course.domain.FsUserCourse;
import com.fs.course.param.*;
import com.fs.course.param.newfs.FsUserCourseListParam;
import com.fs.course.vo.*;
import com.fs.course.vo.newfs.FsUserCourseListVO;
import com.fs.his.vo.OptionsVO;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Map;

/**
 * 课程Service接口
 *
 * @author fs
 * @date 2024-05-15
 */
public interface IFsUserCourseService
{
    /**
     * 查询课程
     *
     * @param courseId 课程主键
     * @return 课程
     */
    public FsUserCourse selectFsUserCourseByCourseId(Long courseId);

    /**
     * 查询课程列表
     *
     * @param fsUserCourse 课程
     * @return 课程集合
     */
    public List<FsUserCourse> selectFsUserCourseList(FsUserCourse fsUserCourse);

    /**
     * 新增课程
     *
     * @param fsUserCourse 课程
     * @return 结果
     */
    public int insertFsUserCourse(FsUserCourse fsUserCourse);

    /**
     * 修改课程
     *
     * @param fsUserCourse 课程
     * @return 结果
     */
    public int updateFsUserCourse(FsUserCourse fsUserCourse);

    /**
     * 批量删除课程
     *
     * @param courseIds 需要删除的课程主键集合
     * @return 结果
     */
    public int deleteFsUserCourseByCourseIds(Long[] courseIds);

    /**
     * 删除课程信息
     *
     * @param courseId 课程主键
     * @return 结果
     */
    public int deleteFsUserCourseByCourseId(Long courseId);


    FsUserCourseUVO selectFsUserCourseUVOByCourseId(Long courseId);


    int updateViews(Long courseId);

    int updateShares(Long courseId);

    int updateLikes(Long courseId, Integer type);

    int updateFavorite(Long courseId, Integer type);

    List<FsUserCourseListUVO> selectFsUserCourseListUVO(FsUserCourseListUParam param);

    List<OptionsVO> selectFsUserCourseAllList();

    List<FsUserCourseListPVO> selectFsUserCourseListPVO(FsUserCourse param);

    int updateDuration(FsUserCourseAddStudyCourseParam param);

    R addStudyCourse(FsUserCourseAddStudyCourseParam param);

    int updateFsUserCourseIsShow(Long[] courseIds, int status);

    R getIntegralByCourseVideo(FsUserCourseGetIntegralParam param);


    List<FsUserCourseListUVO> selectFsUserCourseCommentListUVO(FsUserCourseListUParam param);


    FsUserCourseVideoH5VO selectFsUserCourseVideoH5VOByVideoId(Long videoId);

    FsUserCourseVideoH5DVO selectFsUserCourseVideoH5DVOByVideoId(Long videoId);

    List<FsUserCourseListPVO> selectFsUserCourseListCompanyPVO(FsUserCourseParam fsUserCourse);

    /**
     * h5 获取用户课程下拉列表
     * @return
     */
    List<FsUserCourseListVO> getFsUserCourseList(FsUserCourseListParam param);

    /**
     * 查询用户参与记录
     * @param params 条件
     * @return  list
     */
    List<FsUserCourseParticipationRecordVO> getParticipationRecordByMap(Map<String, Object> params);

    /**
     * 创建生成课程短链
     * @param param 入参
     * @return
     */
    R createCourseSortLink(FsCourseLinkCreateParam param);

    /**
     * 生成海报
     * @param url
     * @param backgroundImagePath
     * @param file
     * @param outputFormat
     * @param title
     * @param duration
     * @return
     * @throws Exception
     */
    String createCourseImageQR(String url, String backgroundImagePath, InputStream file, String outputFormat, String title, String duration) throws Exception;

    /**
     * 创建 分享成为会员 短链
     * @param param 入参
     * @return
     */
    R createCourseMemberSortLink(FsCourseLinkCreateParam param);

    /**
     * 获取链接图片或者本地图片
     * @param url 链接地址
     * @param path 本地图片路径
     * @return
     * @throws IOException
     */
    InputStream handleImage(String url, String path) throws IOException;

    /**
     * 生成分享成为会员海报
     * @param url
     * @param backgroundImagePath
     * @param file
     * @param outputFormat
     * @param companyUserId
     * @return
     * @throws Exception
     */
    String createUserImageQR(String url, String backgroundImagePath, InputStream file, String outputFormat, Long companyUserId) throws Exception;

    List<FsCourseListBySidebarVO> getFsCourseListBySidebar(FsCourseListBySidebarParam param);
}
