package com.cmvr.vi.service.ex;

import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.cmvr.test.service.ex.ExViCorpusService;
import com.cmvr.vi.model.domain.ViCorpus;
import com.cmvr.vi.service.IViCorpusService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@RequiredArgsConstructor
public class ExViCorpusServiceImpl implements ExViCorpusService {

    private final IViCorpusService viCorpusService;

    @Override
    public JSONObject queryById(String id) {
        ViCorpus viCorpus = viCorpusService.queryCorpusByParentId(id);
        return JSONObject.from(viCorpus);
    }

    @Override
    public JSONArray queryInIds(List<String> corpusIds) {
        List<ViCorpus> viCorpus = viCorpusService.queryCorpusInParentIds(corpusIds);
        return JSONArray.from(viCorpus);
    }
}
