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

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import cokr.xit.fims.nxrp.service.bean.SnisBean;
import cokr.xit.fims.sndb.SndbQuery;
import cokr.xit.fims.sndb.SndngDtl;
import cokr.xit.fims.sndb.service.SndngDtlService;
import cokr.xit.foundation.Downloadable;
import cokr.xit.foundation.component.ScheduledServiceBean;
import cokr.xit.foundation.data.DataObject;

/**발송 상세 서비스 구현체.
 *
 * <p>상세 설명:
 *
 * <pre>
 * ============ 변경 이력 ============
 * 2023-12-27	JoJH 최초 작성
 * ================================
 * </pre>
 */
@Service("sndngDtlService")
public class SndngDtlServiceBean extends ScheduledServiceBean implements SndngDtlService {
	/** 발송 상세 정보 Bean */
	@Resource(name = "sndngDtlBean")
	private SndngDtlBean sndngDtlBean;
	@Resource(name = "snisBean")
	private SnisBean snisBean;

	/** 공시송달 대장 정보 Bean */
	@Resource(name = "svbtcBean")
	private SvbtcBean svbtcBean;

	@Override
	public List<SndngDtl> getSndngDetails(SndbQuery req) {
		return sndngDtlBean.getSndngDetails(req);
	}

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

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

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

	@Override
	public String setNxrpIndivA01List(SndngDtl sndngDtl) {
		return sndngDtlBean.setNxrpIndivA01List(sndngDtl);
	}

	@Override
	public Downloadable downloadPreNotices(SndbQuery req) {
		return snisBean.downloadPreNotices(req);
	}

	@Override
	public String registerPreNotice(SndbQuery req) {
		return snisBean.registerPreNotices(req);
	}

	@Override
	public String getNxrpIndivA03List(SndngDtl sndngDtl) {
		return sndngDtlBean.getNxrpIndivA03List(sndngDtl);
	}

	@Override
	public String updatePreNotice(SndngDtl sndngDtl) {
		snisBean.lookupPreNotices(sndngDtl);
		return "[S] 저장됐습니다.";
	}
	
	@Override
	public String updatePreNotice(String buAk) {
		snisBean.lookupPreNotices(buAk);
		return "[S] 저장됐습니다.";
	}	

	@Override
	public void updatePreNotices() {
		execute(snisBean, () -> snisBean.lookupPreNotices((SndbQuery)null));
	}

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

	@Override
	public DataObject getSndbkInfo(SndbQuery req) {
		return sndngDtlBean.getSndbkInfo(req);
	}

	@Override
	public String createSndbkList(SndbQuery req) {
		return sndngDtlBean.createSndbkList(req);
	}

	@Override
	public String createSndbk(SndngDtl sndngDtl) {
		return sndngDtlBean.createSndbk(sndngDtl);
	}

	@Override
	public String updateSndbk(SndngDtl sndngDtl) {
		return sndngDtlBean.updateSndbk(sndngDtl);
	}

	@Override
	public String removeSndbk(SndngDtl sndngDtl) {
		return sndngDtlBean.removeSndbk(sndngDtl);
	}

	@Override
	public List<DataObject> getDetailList(List<String> sndngIDs) {
		return sndngDtlBean.getDetailList(sndngIDs);
	}
}