package com.sikey.wa04.business.infrastructure.adapter.dao;

import com.sikey.wa04.business.domain.adapter.NotifyAdapter;
import com.sikey.wa04.business.domain.entity.Notify;
import com.sikey.wa04.business.infrastructure.dto.model.NotifyModel;
import com.sikey.wa04.business.infrastructure.repository.NotifyRepository;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * NotifyAdapterImpl
 *
 * @author qin
 */
@Slf4j
@Component
public class NotifyAdapterImpl implements NotifyAdapter {

    @Resource
    private NotifyRepository notifyRepository;


    @Override
    public void save(Notify notify) {
        NotifyModel notifyModel = new NotifyModel();
        notifyModel.setNotifyId(notify.getNotifyId());
        notifyModel.setSender(notify.getSender());
        notifyModel.setReceiver(notify.getReceiver());
        notifyModel.setPayload(notify.getPayload());
        notifyRepository.save(notifyModel);
    }
}
