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

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import cokr.xit.fims.payer.Payer;
import cokr.xit.fims.payer.PayerQuery;
import cokr.xit.fims.payer.service.PayerService;
import cokr.xit.foundation.component.AbstractServiceBean;
import cokr.xit.foundation.data.DataObject;
import cokr.xit.interfaces.lvis.service.reg.BasicInfoRequest;

/**납부자 대장 서비스 구현체.
 *
 * <p>상세 설명:
 *
 * <pre>
 * ============ 변경 이력 ============
 * 2023-08-18	mjkhan 최초 작성
 * ================================
 * </pre>
 */
@Service("payerService")
public class PayerServiceBean extends AbstractServiceBean implements PayerService {
	/** 납부자 대장 정보 Bean */
	@Resource(name = "payerBean")
	private PayerBean payerBean;

	@Override
	public List<DataObject> getPayerList(PayerQuery req) {
		return payerBean.getPayerList(req);
	}

	@Override
	public List<Payer> getPayers(PayerQuery req) {
		return payerBean.getPayers(req);
	}

	@Override
	public boolean create(Payer payer) {
		return payerBean.create(payer);
	}

	@Override
	public boolean update(Payer payer) {
		return payerBean.update(payer);
	}

	@Override
	public int remove(String... rtpyrIds) {
		return payerBean.remove(rtpyrIds);
	}

	@Override
	public Payer getVehicleOwner(BasicInfoRequest req) {
		List<Payer> payers = payerBean.getVehicleOwners(List.of(req));
		return !payers.isEmpty() ? payers.get(0) : null;
	}
}