package cokr.xit.fims.sndb.service.bean;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import cokr.xit.fims.mngt.service.bean.TaskProcessor;
import cokr.xit.fims.sndb.SndbQuery;
import cokr.xit.fims.sndb.Sndng;
import cokr.xit.fims.sndb.service.SndngService;
import cokr.xit.foundation.component.AbstractServiceBean;
import cokr.xit.foundation.data.DataObject;
import cokr.xit.foundation.data.DataProc;

/**발송 대장 서비스 구현체.
*
* <p>상세 설명:
*
* <pre>
* ============ 변경 이력 ============
* 2023-08-25	JoJH 최초 작성
* ================================
* </pre>
*/
@Service("sndngService")
public class SndngServiceBean extends AbstractServiceBean implements SndngService {
	/** 발송 대장 정보 Bean */
	@Resource(name = "sndngBean")
	private SndngBean sndngBean;
	/** 발송 상세 정보 Bean */
	@Resource(name = "sndngDtlBean")
	private SndngDtlBean sndngDtlBean;
	@Resource(name = "postplusBean")
	private PostplusBean postplusBean;

	@Override
	public List<DataObject> getWrngTrgtList(SndbQuery req) {
		return sndngBean.getWrngTrgtList(req);
	}

	@Override
	public List<DataObject> getWrngTrgts(SndbQuery req) {
		return sndngBean.getWrngTrgts(req);
	}

	@Override
	public List<DataObject> getWrngSndngList(SndbQuery req) {
		return sndngBean.getSndngList(req);
	}

    @Override
    public DataProc createWrngSndngList(SndbQuery req, Sndng sndng) {
        return sndngBean.createWrngSndngList(req, sndng);
    }

    @Override
    public String removeWrngSndng(Sndng sndng) {
        return sndngBean.removeWrngSndng(sndng);
    }

	@Override
	public List<DataObject> getAdvntceTrgtList(SndbQuery req) {
		return sndngBean.getAdvntceTrgtList(req);
	}

	@Override
	public List<DataObject> getAdvntceTrgts(SndbQuery req) {
		return sndngBean.getAdvntceTrgts(req);
	}

	@Override
	public List<DataObject> getAdvntceSndngList(SndbQuery req) {
		return sndngBean.getSndngList(req);
	}

    @Override
    public DataProc createAdvntceSndngList(SndbQuery req, Sndng sndng) {
        return sndngBean.createAdvntceSndngList(req, sndng);
    }

    @Override
    public String removeAdvntceSndng(Sndng sndng) {
        return sndngBean.removeAdvntceSndng(sndng);
    }

	@Override
	public List<DataObject> getNhtTrgtList(SndbQuery req) {
		return sndngBean.getNhtTrgtList(req);
	}

	@Override
	public List<DataObject> getNhtTrgts(SndbQuery req) {
		return sndngBean.getNhtTrgts(req);
	}

	@Override
	public DataProc createNhtSndngList(SndbQuery req, Sndng sndng) {
		return sndngBean.createNhtSndngList(req, sndng);
	}

	@Override
	public List<DataObject> getNhtSndngList(SndbQuery req) {
		return sndngBean.getSndngList(req);
	}

	@Override
	public List<DataObject> getSndngList(SndbQuery req) {
		return sndngBean.getSndngList(req);
	}

	@Override
	public List<Sndng> getSndngs(SndbQuery req) {
		return sndngBean.getSndngs(req);
	}

	@Override
	public String createSndngLink(Sndng sndng) {
		String delivery = TaskProcessor.get().getNoticeDelivery(sndng.getTaskSeCd());
		return switch (delivery) {
		case "eGreen" -> sndngBean.createEPost(sndng);
		case "postplus" -> postplusBean.requestProduction(sndng);
		default -> "[F] Unknown notice delivery: " + delivery;
		};
	}

	@Override
	public String removeSndng(Sndng sndng) {
		return sndngBean.removeSndng(sndng);
	}
}