package com.brilliance.isc.convert.mt4xx;

import com.brilliance.isc.swift.objmtconvert.manager.MtCreatorManager;
import com.brilliance.isc.swift.objmtconvert.model.commontag.ActnoBicAdrTagXXX;
import com.brilliance.isc.swift.objmtconvert.model.commontag.DcDateCurAmtTagXXX;
import com.brilliance.isc.swift.objmtconvert.model.mt4xx.MT400Creator;
import com.brilliance.isc.swift.objmtconvert.model.mt4xx.MT410Creator;
import com.brilliance.isc.swift.objmtconvert.model.mt4xx.mt4XXAbsCreator.MT410AbsCreator;
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 MT410Test {

    @Test
    public void test_410(){
        MT410Creator mt410Creator = new MT410Creator("410");
        mt410Creator.setRecvBic("CIPSCNSHXXX");//收报行
        mt410Creator.setSendBic("PSBCCNBJXXX");//发报行
        List<MT410AbsCreator> mt410AbsCreators = new ArrayList<>();
        MT410AbsCreator mt410AbsCreator = new MT410AbsCreator();
        //20
        mt410AbsCreator.setSendingBankTRN("COL456");
        //21
        mt410AbsCreator.setRelatedReference("REM432");
        //32 32K
        DcDateCurAmtTagXXX amountAcknowledged32K = new DcDateCurAmtTagXXX("32");
        amountAcknowledged32K.setDayMonth("D");
        amountAcknowledged32K.setNumberOfDaysMonths("000");
        amountAcknowledged32K.setCode("ST");
        amountAcknowledged32K.setCurrency("EUR");
        amountAcknowledged32K.setAmount(new BigDecimal("10000.00"));
        mt410AbsCreator.setAmountAcknowledged(amountAcknowledged32K);
        mt410AbsCreators.add(mt410AbsCreator);

        MT410AbsCreator mt410AbsCreator2 = new MT410AbsCreator();
        //20
        mt410AbsCreator2.setSendingBankTRN("COL456");
        //21
        mt410AbsCreator2.setRelatedReference("REM432");
        //32 32A
        DcDateCurAmtTagXXX amountAcknowledged32A = new DcDateCurAmtTagXXX("32");
        amountAcknowledged32A.setDate("220609");
        amountAcknowledged32A.setCurrency("EUR");
        amountAcknowledged32A.setAmount(new BigDecimal("10000.00"));
        mt410AbsCreator2.setAmountAcknowledged(amountAcknowledged32A);
        mt410AbsCreators.add(mt410AbsCreator2);

        MT410AbsCreator mt410AbsCreator3 = new MT410AbsCreator();
        //20
        mt410AbsCreator3.setSendingBankTRN("COL456");
        //21
        mt410AbsCreator3.setRelatedReference("REM432");
        //32 32B
        DcDateCurAmtTagXXX amountAcknowledged32B = new DcDateCurAmtTagXXX("32");
        amountAcknowledged32B.setCurrency("EUR");
        amountAcknowledged32B.setAmount(new BigDecimal("10000"));
        mt410AbsCreator3.setAmountAcknowledged(amountAcknowledged32B);
        mt410AbsCreators.add(mt410AbsCreator3);
        mt410Creator.setMt410AbsCreators(mt410AbsCreators);
        //72
        mt410Creator.setSenderToReceiverInformation("/HOLDING/"+ Constans.NEW_LINE+"GOODS WAREHOUSED AND INSURED");
        MtResult mtResult= MtCreatorManager.packMT(mt410Creator);
    }
    @Test
    public void test_410_2(){
        MT410Creator mt410Creator = new MT410Creator("410");
        mt410Creator.setRecvBic("CIPSCNSHXXX");//收报行
        mt410Creator.setSendBic("PSBCCNBJXXX");//发报行
        List<MT410AbsCreator> mt410AbsCreators = new ArrayList<>();
        MT410AbsCreator mt410AbsCreator = new MT410AbsCreator();
        //20
        mt410AbsCreator.setSendingBankTRN("COL456AAAAAAAAAAAAAAAAAAAA");
        //21
        mt410AbsCreator.setRelatedReference("REM432AAAAAAAAAAAAAAAAAAA");
        //32 32K
        DcDateCurAmtTagXXX amountAcknowledged32K = new DcDateCurAmtTagXXX("32");
        amountAcknowledged32K.setDayMonth("DAAAAA");
        amountAcknowledged32K.setNumberOfDaysMonths("000AAAA");
        amountAcknowledged32K.setCode("STAAA");
        amountAcknowledged32K.setCurrency("EUR");
        amountAcknowledged32K.setAmount(new BigDecimal("10000.00"));
        mt410AbsCreator.setAmountAcknowledged(amountAcknowledged32K);
        mt410AbsCreators.add(mt410AbsCreator);

        MT410AbsCreator mt410AbsCreator2 = new MT410AbsCreator();
        //20
        mt410AbsCreator2.setSendingBankTRN("COL456");
        //21
        mt410AbsCreator2.setRelatedReference("REM432");
        //32 32A
        DcDateCurAmtTagXXX amountAcknowledged32A = new DcDateCurAmtTagXXX("32");
        amountAcknowledged32A.setDate("220609");
        amountAcknowledged32A.setCurrency("EUR");
        amountAcknowledged32A.setAmount(new BigDecimal("10000.00"));
        mt410AbsCreator2.setAmountAcknowledged(amountAcknowledged32A);
        mt410AbsCreators.add(mt410AbsCreator2);

        MT410AbsCreator mt410AbsCreator3 = new MT410AbsCreator();
        //20
        mt410AbsCreator3.setSendingBankTRN("COL456");
        //21
        mt410AbsCreator3.setRelatedReference("REM432");
        //32 32B
        DcDateCurAmtTagXXX amountAcknowledged32B = new DcDateCurAmtTagXXX("32");
        amountAcknowledged32B.setCurrency("EUR");
        amountAcknowledged32B.setAmount(new BigDecimal("10000.00"));
        mt410AbsCreator3.setAmountAcknowledged(amountAcknowledged32B);
        mt410AbsCreators.add(mt410AbsCreator3);
        mt410Creator.setMt410AbsCreators(mt410AbsCreators);
        //72
        mt410Creator.setSenderToReceiverInformation("/HOLDING/");
        MtResult mtResult= MtCreatorManager.packMT(mt410Creator);
    }
    @Test
    public void test_410_3(){
        MT410Creator mt410Creator = new MT410Creator("410");
        mt410Creator.setRecvBic("CIPSCNSHXXX");//收报行
        mt410Creator.setSendBic("PSBCCNBJXXX");//发报行
        List<MT410AbsCreator> mt410AbsCreators = new ArrayList<>();
        MT410AbsCreator mt410AbsCreator = new MT410AbsCreator();
        //20
        mt410AbsCreator.setSendingBankTRN("COL456");
        //21
        mt410AbsCreator.setRelatedReference("REM432");
        //32 32K
        DcDateCurAmtTagXXX amountAcknowledged32K = new DcDateCurAmtTagXXX("32");
        amountAcknowledged32K.setDayMonth("D");
        amountAcknowledged32K.setNumberOfDaysMonths("000");
        amountAcknowledged32K.setCode("ST");
        amountAcknowledged32K.setCurrency("EUR");
        amountAcknowledged32K.setAmount(new BigDecimal("10000.00"));
        mt410AbsCreator.setAmountAcknowledged(amountAcknowledged32K);
        mt410AbsCreators.add(mt410AbsCreator);

        MT410AbsCreator mt410AbsCreator2 = new MT410AbsCreator();
        //20
        mt410AbsCreator2.setSendingBankTRN("COL456");
        //21
        mt410AbsCreator2.setRelatedReference("REM432");
        //32 32A
        DcDateCurAmtTagXXX amountAcknowledged32A = new DcDateCurAmtTagXXX("32");
        amountAcknowledged32A.setDate("220609");
        amountAcknowledged32A.setCurrency("EUR");
        amountAcknowledged32A.setAmount(new BigDecimal("10000.00"));
        mt410AbsCreator2.setAmountAcknowledged(amountAcknowledged32A);
        mt410AbsCreators.add(mt410AbsCreator2);

        MT410AbsCreator mt410AbsCreator3 = new MT410AbsCreator();
        //20
        mt410AbsCreator3.setSendingBankTRN("COL456");
        //21
        mt410AbsCreator3.setRelatedReference("REM432");
        //32 32B
        DcDateCurAmtTagXXX amountAcknowledged32B = new DcDateCurAmtTagXXX("32");
        amountAcknowledged32B.setCurrency("USD");
        amountAcknowledged32B.setAmount(new BigDecimal("10000.00"));
        mt410AbsCreator3.setAmountAcknowledged(amountAcknowledged32B);
        mt410AbsCreators.add(mt410AbsCreator3);
        mt410AbsCreators.add(mt410AbsCreator3);
        mt410AbsCreators.add(mt410AbsCreator3);
        mt410AbsCreators.add(mt410AbsCreator3);
        mt410AbsCreators.add(mt410AbsCreator3);
        mt410AbsCreators.add(mt410AbsCreator3);
        mt410AbsCreators.add(mt410AbsCreator3);
        mt410AbsCreators.add(mt410AbsCreator3);
        mt410AbsCreators.add(mt410AbsCreator3);
        mt410AbsCreators.add(mt410AbsCreator3);
        mt410AbsCreators.add(mt410AbsCreator3);
        mt410AbsCreators.add(mt410AbsCreator3);
        mt410Creator.setMt410AbsCreators(mt410AbsCreators);
        //72
        mt410Creator.setSenderToReceiverInformation("/HOLDING/");
        MtResult mtResult= MtCreatorManager.packMT(mt410Creator);
    }
}
