package com.bytesw.bytebot.service;

import com.bytesw.bytebot.bean.BdcControlBean;
import com.bytesw.bytebot.model.BdcControl;
import com.bytesw.bytebot.repository.BdcControlRepository;
import com.bytesw.xdf.service.XDFService;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
@Log4j2
public class BcdControlService extends XDFService<BdcControl, BdcControlBean, Long> {
    protected BcdControlService(BdcControlRepository repository) {
        super(repository);
    }

    @Override
    protected BdcControl toModel(BdcControl model, BdcControlBean bean) {
        if (model == null) {
            model = new BdcControl();
        }
        BeanUtils.copyProperties(bean, model);
        return model;
    }

    @Override
    protected BdcControlBean toBean(BdcControl model) {
        BdcControlBean bean = new BdcControlBean();
        BeanUtils.copyProperties(model, bean);
        return bean;
    }

}
