package com.brilliance.isc.convert.mt4xx;

import com.brilliance.isc.swift.objmtconvert.manager.MtCreatorManager;
import com.brilliance.isc.swift.objmtconvert.model.commontag.DcDateCurAmtTagXXX;
import com.brilliance.isc.swift.objmtconvert.model.mt4xx.MT410Creator;
import com.brilliance.isc.swift.objmtconvert.model.mt4xx.MT412Creator;
import com.brilliance.isc.swift.objmtconvert.model.mt4xx.mt4XXAbsCreator.MT410AbsCreator;
import com.brilliance.isc.swift.objmtconvert.model.mt4xx.mt4XXAbsCreator.MT412AbsCreator;
import com.brilliance.isc.swift.objmtconvert.result.MtResult;
import com.brilliance.isc.swift.objmtconvert.util.Constans;
import org.junit.Test;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * @author gechengyang
 * @date 2023/2/27
 */
public class MT412Test {

    @Test
    public void test_412(){
        MT412Creator mt412Creator = new MT412Creator("412");
        mt412Creator.setRecvBic("CIPSCNSHXXX");//收报行
        mt412Creator.setSendBic("PSBCCNBJXXX");//发报行
        List<MT412AbsCreator> mt412AbsCreators = new ArrayList<>();
        MT412AbsCreator mt412AbsCreator = new MT412AbsCreator();
        //20
        mt412AbsCreator.setSendingBankTRN("COL456");
        //21
        mt412AbsCreator.setRelatedReference("REM432");
        //32
        DcDateCurAmtTagXXX dateCurrencyAmount = new DcDateCurAmtTagXXX("32");
        dateCurrencyAmount.setDate("220908");
        dateCurrencyAmount.setCurrency("EUR");
        dateCurrencyAmount.setAmount(new BigDecimal("10000.00"));
        mt412AbsCreator.setDateCurrencyAmount(dateCurrencyAmount);
        mt412AbsCreators.add(mt412AbsCreator);
        mt412AbsCreators.add(mt412AbsCreator);
        mt412Creator.setMt412AbsCreators(mt412AbsCreators);
        //72
        mt412Creator.setSenderToReceiverInformation("/HOLDING/");
        MtResult mtResult= MtCreatorManager.packMT(mt412Creator);
    }
    @Test
    public void test_412_2(){
        MT412Creator mt412Creator = new MT412Creator("412");
        mt412Creator.setRecvBic("CIPSCNSHXXX");//收报行
        mt412Creator.setSendBic("PSBCCNBJXXX");//发报行
        List<MT412AbsCreator> mt412AbsCreators = new ArrayList<>();
        MT412AbsCreator mt412AbsCreator = new MT412AbsCreator();
        //20
        mt412AbsCreator.setSendingBankTRN("COL456AAAAAAAAAAAAAAAA");
        //21
        mt412AbsCreator.setRelatedReference("REM432AAAAAAAAAAAA");
        //32
        DcDateCurAmtTagXXX dateCurrencyAmount = new DcDateCurAmtTagXXX("32");
        dateCurrencyAmount.setDate("22090AAA");
        dateCurrencyAmount.setCurrency("EURAAAAA");
        dateCurrencyAmount.setAmount(new BigDecimal("10000.00"));
        mt412AbsCreator.setDateCurrencyAmount(dateCurrencyAmount);
        mt412AbsCreators.add(mt412AbsCreator);
        mt412AbsCreators.add(mt412AbsCreator);
        mt412Creator.setMt412AbsCreators(mt412AbsCreators);
        //72
        mt412Creator.setSenderToReceiverInformation("/HOLDING/");
        MtResult mtResult= MtCreatorManager.packMT(mt412Creator);
    }
    @Test
    public void test_412_3(){
        MT412Creator mt412Creator = new MT412Creator("412");
        mt412Creator.setRecvBic("CIPSCNSHXXX");//收报行
        mt412Creator.setSendBic("PSBCCNBJXXX");//发报行
        List<MT412AbsCreator> mt412AbsCreators = new ArrayList<>();
        MT412AbsCreator mt412AbsCreator = new MT412AbsCreator();
        //20
        mt412AbsCreator.setSendingBankTRN("COL456");
        //21
        mt412AbsCreator.setRelatedReference("REM432");
        //32
        DcDateCurAmtTagXXX dateCurrencyAmount = new DcDateCurAmtTagXXX("32");
        dateCurrencyAmount.setDate("220908");
        dateCurrencyAmount.setCurrency("EUR");
        dateCurrencyAmount.setAmount(new BigDecimal("10000.00"));
        mt412AbsCreator.setDateCurrencyAmount(dateCurrencyAmount);

        MT412AbsCreator mt412AbsCreator2 = new MT412AbsCreator();
        //20
        mt412AbsCreator2.setSendingBankTRN("COL456");
        //21
        mt412AbsCreator2.setRelatedReference("REM432");
        //32
        DcDateCurAmtTagXXX dateCurrencyAmount2 = new DcDateCurAmtTagXXX("32");
        dateCurrencyAmount2.setDate("220908");
        dateCurrencyAmount2.setCurrency("USD");
        dateCurrencyAmount2.setAmount(new BigDecimal("10000.00"));
        mt412AbsCreator2.setDateCurrencyAmount(dateCurrencyAmount2);

        mt412AbsCreators.add(mt412AbsCreator);
        mt412AbsCreators.add(mt412AbsCreator);
        mt412AbsCreators.add(mt412AbsCreator);
        mt412AbsCreators.add(mt412AbsCreator);
        mt412AbsCreators.add(mt412AbsCreator);
        mt412AbsCreators.add(mt412AbsCreator);
        mt412AbsCreators.add(mt412AbsCreator);
        mt412AbsCreators.add(mt412AbsCreator);
        mt412AbsCreators.add(mt412AbsCreator);
        mt412AbsCreators.add(mt412AbsCreator);
        mt412AbsCreators.add(mt412AbsCreator);
        mt412AbsCreators.add(mt412AbsCreator);
        mt412AbsCreators.add(mt412AbsCreator);
        mt412AbsCreators.add(mt412AbsCreator);
        mt412AbsCreators.add(mt412AbsCreator);
        mt412AbsCreators.add(mt412AbsCreator2);
        mt412Creator.setMt412AbsCreators(mt412AbsCreators);
        //72
        mt412Creator.setSenderToReceiverInformation("/HOLDING/"+ Constans.NEW_LINE+"GOODS WAREHOUSED AND INSURED");
        MtResult mtResult= MtCreatorManager.packMT(mt412Creator);
    }
}
