package com.ycwl.basic.mapper;

import com.ycwl.basic.model.pc.source.entity.MemberSourceEntity;
import com.ycwl.basic.model.pc.source.entity.SourceEntity;
import com.ycwl.basic.model.pc.source.entity.SourceWatermarkEntity;
import com.ycwl.basic.model.pc.source.req.SourceReqQuery;
import com.ycwl.basic.model.pc.source.resp.SourceRespVO;
import org.apache.ibatis.annotations.Mapper;

import java.util.Date;
import java.util.List;

/**
 * @Author：longbinbin
 * @Date：2024/12/2 11:21
 * 视频源
 */
@Mapper
public interface SourceMapper {
    List<SourceRespVO> list(SourceReqQuery sourceReqQuery);

    SourceRespVO getById(Long id);
    SourceRespVO userGetById(Long id, Long userId);

    List<SourceEntity> listBySampleIds(List<Long> sourceIds);

    int add(SourceEntity source);

    int deleteById(Long id);

    int update(SourceEntity source);

    /**
     * @param sourceReqQuery
     * @return
     */
    List<SourceRespVO> listGroupByType(SourceReqQuery sourceReqQuery);

    /**
     * 用户素材数量
     *
     * @param userId
     * @return
     */
    int countByMemberId(String userId);

    List<SourceEntity> listVideoBySampleIds(List<Long> sampleId);

    SourceEntity findBySampleId(Long faceSampleId);

    int addRelation(MemberSourceEntity source);

    List<SourceRespVO> listUser(SourceReqQuery sourceReqQuery);
    Integer countUser(SourceReqQuery sourceReqQuery);
    SourceRespVO listUserOne(Long userId, Long sourceId);

    int addRelations(List<MemberSourceEntity> list);

    int updateRelation(MemberSourceEntity memberSourceEntity);

    List<SourceRespVO> queryByRelation(SourceReqQuery sourceReqQuery);

    SourceEntity querySameVideo(Long faceSampleId, Long deviceId);

    int hasRelationTo(Long memberId, Long sourceId, int type);

    List<SourceEntity> listVideoByScenicFaceRelation(Long scenicId, Long faceId);
    List<SourceEntity> listVideoByFaceRelation(Long memberId, Long faceId);

    List<SourceEntity> listImageByFaceRelation(Long memberId, Long faceId);

    SourceEntity getEntity(Long id);

    int deleteNotRelateSource(int type, Date endDate);

    int deleteNotBuyRelations(Long scenicId, Date endDate);

    int deleteNotBuyFaceRelation(Long userId, Long faceId);
    List<SourceWatermarkEntity> listSourceWatermark(List<Long> sourceIds, Long faceId, String watermarkType);

    void addSourceWatermark(Long sourceId, Long faceId, String type, String url);

    int deleteUselessSource();
}
