package com.seer.teach.teacher.convert;


import com.seer.teach.common.dto.mq.LlmChatDTO;
import com.seer.teach.teacher.common.dto.TeachAudios;
import com.seer.teach.teacher.common.dto.TeachDTO;
import com.seer.teach.teacher.module.entity.*;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

/**
 * @Author: Captain
 * @Description:
 * @Date: 2025-06-24 17:28
 */
@Mapper
public interface TeachConvert {

    TeachConvert INSTANCE = Mappers.getMapper(TeachConvert.class);

    @Mapping(source = "know.id", target = "id")
    @Mapping(source = "know.knowledgePointName", target = "knowledgePointName")
    @Mapping(source = "summary.summary", target = "summary")
    @Mapping(source = "goal.goal", target = "goal")
    @Mapping(source = "goal.point", target = "point")
    @Mapping(source = "goal.sort", target = "sort")
    @Mapping(source = "text.videoUrl", target = "videoUrl")
    @Mapping(source = "goal.id", target = "goalId")
    @Mapping(source = "text.id", target = "textId")
    @Mapping(source = "text.text", target = "text")
    @Mapping(target = "audios", ignore = true)
    TeachDTO toTeachDTO(KnowledgePointEntity know,
                        KnowSummaryEntity summary,
                        TeachGoalsEntity goal,
                        TeachTextsEntity text);

    @Mapping(source = "sort", target = "sort")
    @Mapping(source = "data", target = "data")
    @Mapping(source = "text", target = "text")
    @Mapping(target = "isFinal", ignore = true)
    TeachAudios toTeachAudios(TeachTextAudiosEntity entity);

    @Mapping(source = "audio.sort", target = "sort")
    @Mapping(source = "audio.data", target = "audioData")
    @Mapping(source = "audio.text", target = "text")
    @Mapping(source = "audio.isFinal", target = "isFinal")
    @Mapping(source = "currentTime", target = "mqTime")
    @Mapping(source = "sessionId", target = "id")
    LlmChatDTO toLlmChatDTO(Integer sessionId, TeachAudios audio,long currentTime);
}
