package com.datamate.datamanagement.interfaces.converter;

import com.datamate.datamanagement.domain.model.knowledge.KnowledgeItem;
import com.datamate.datamanagement.domain.model.knowledge.KnowledgeSet;
import com.datamate.datamanagement.interfaces.dto.CreateKnowledgeItemRequest;
import com.datamate.datamanagement.interfaces.dto.CreateKnowledgeSetRequest;
import com.datamate.datamanagement.interfaces.dto.KnowledgeItemResponse;
import com.datamate.datamanagement.interfaces.dto.KnowledgeSetResponse;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * 知识管理转换器
 */
@Mapper
public interface KnowledgeConverter {
    KnowledgeConverter INSTANCE = Mappers.getMapper(KnowledgeConverter.class);

    @Mapping(target = "tags", ignore = true)
    KnowledgeSet convertToKnowledgeSet(CreateKnowledgeSetRequest request);

    KnowledgeItem convertToKnowledgeItem(CreateKnowledgeItemRequest request);

    KnowledgeSetResponse convertToResponse(KnowledgeSet knowledgeSet);

    List<KnowledgeSetResponse> convertSetResponses(List<KnowledgeSet> sets);

    KnowledgeItemResponse convertToResponse(KnowledgeItem knowledgeItem);

    List<KnowledgeItemResponse> convertItemResponses(List<KnowledgeItem> items);
}
