package cokr.xit.ens.modules.kkoalimtalk.service;

import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.entity.Bill;
import cokr.xit.ens.modules.common.domain.SendMast;
import cokr.xit.ens.modules.kkoalimtalk.domain.SendDetailKkoAlimtalk;
import cokr.xit.ens.modules.kkoalimtalk.domain.repository.SendDetailKkoAlimtalkRepository;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;

@SpringBootTest
class KkoAlimtalkMakeServiceTest {

    @Autowired
    private SendDetailKkoAlimtalkRepository sendDetailKkoAlimtalkRepository;

    @Test
    @Transactional
    void begin() {
        Long sendMastId = 01L;
        List<SendDetailKkoAlimtalk> list = sendDetailKkoAlimtalkRepository.findAllFetchBySendMastId(sendMastId);
        AtomicInteger i = new AtomicInteger(1);
        list.stream().forEach(row -> {
            System.out.println("===========================================================================");
            System.out.println("### SendMast - " + (i));
            SendMast sendMast = row.getSendMast();
            System.out.println(sendMast.toString());
            System.out.println("### KkoBillMast - " + (i.getAndIncrement()));
//            KkoBillMast kkoBillMast = row.getKkoBillMast();
//            System.out.println(kkoBillMast.toString());
            Bill bill = row.getBill();
            System.out.println(bill.toString());
            System.out.println("===========================================================================");
        });
    }

    @Test
    void making() {
    }

    @Test
    void makingPhoneNumber() {
    }

    @Test
    void makingBillLink() {
    }

    @Test
    void makingTmpltMsg() {
    }

    @Test
    void end() {
    }
}