package com.brilliance.isc.convert.mt9xx;

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.mt9xx.MT941Creator;
import com.brilliance.isc.swift.objmtconvert.result.MtResult;
import com.brilliance.isc.swift.objmtconvert.util.JsonUtil;
import com.brilliance.isc.swift.swifteditor.tag.message.MessageAnalyzer;
import com.brilliance.isc.swift.swifteditor.tag.message.SWFMessage;
import org.junit.Test;

import java.math.BigDecimal;
import java.util.*;

/**
 * @author zh
 * @create 2023-03-08-9:35
 */
public class MT941Test {
    @Test
    public void mt941_Test() {
        MT941Creator mt941Creator = new MT941Creator("941");
        //20
        mt941Creator.setTranReferenceNum("234567");
        //21
        mt941Creator.setRelatedReferen("765432");
        //25
        ActnoBicAdrTagXXX accountIdentification=new ActnoBicAdrTagXXX("25");
        accountIdentification.setAcctno("1234567891");
        accountIdentification.setBic("PSBCCNBJ");
        mt941Creator.setAccountIdentification(accountIdentification);
        //28
        mt941Creator.setStattNumSeqNum("212");
        //13D
        mt941Creator.setDateIndication("0906041515+0200");
        //60F
        DcDateCurAmtTagXXX openingBalance = new DcDateCurAmtTagXXX("60");
        openingBalance.setDcMark("C");
        openingBalance.setDate("170928");
        openingBalance.setCurrency("USD");
        openingBalance.setAmount(new BigDecimal("28000.00"));
        mt941Creator.setOpeningBalance(openingBalance);
        //62F
        DcDateCurAmtTagXXX bookBalance = new DcDateCurAmtTagXXX("62");
        bookBalance.setDcMark("C");
        bookBalance.setDate("170928");
        bookBalance.setCurrency("USD");
        bookBalance.setAmount(new BigDecimal("81767.95"));
        mt941Creator.setBookBalance(bookBalance);
        //64
        DcDateCurAmtTagXXX closingAvailableBalance = new DcDateCurAmtTagXXX("64");
        closingAvailableBalance.setDcMark("C");
        closingAvailableBalance.setDate("170928");
        closingAvailableBalance.setCurrency("USD");
        closingAvailableBalance.setAmount(new BigDecimal("81767.95"));
        mt941Creator.setClosingAvailableBalance(closingAvailableBalance);
        //65
        List<DcDateCurAmtTagXXX> list65 = new ArrayList<>();
        DcDateCurAmtTagXXX forwardAvailableBalance = new DcDateCurAmtTagXXX("65");
        forwardAvailableBalance.setDcMark("C");
        forwardAvailableBalance.setDate("170928");
        forwardAvailableBalance.setCurrency("USD");
        forwardAvailableBalance.setAmount(new BigDecimal("81767.95"));
        list65.add(forwardAvailableBalance);
        list65.add(forwardAvailableBalance);
        mt941Creator.setForwardAvailableBalance(list65);
        //90D
        DcDateCurAmtTagXXX numberAndSumOfEntriesD = new DcDateCurAmtTagXXX("90D");
        numberAndSumOfEntriesD.setNumber(111);
        numberAndSumOfEntriesD.setCurrency("USD");
        numberAndSumOfEntriesD.setAmount(new BigDecimal("81767.95"));
        mt941Creator.setNumberAndSumOfEntriesD(numberAndSumOfEntriesD);
        //90D
        DcDateCurAmtTagXXX numberAndSumOfEntriesC = new DcDateCurAmtTagXXX("90C");
        numberAndSumOfEntriesD.setNumber(111);
        numberAndSumOfEntriesC.setCurrency("USD");
        numberAndSumOfEntriesC.setAmount(new BigDecimal("81767.95"));
        mt941Creator.setNumberAndSumOfEntriesC(numberAndSumOfEntriesC);
        //86
        mt941Creator.setInfoAccontOwner("PRIME RATE AS OF TODAY 11 PCT");
        MtResult mtResult = MtCreatorManager.packMT(mt941Creator);
    }
    @Test
    public void mt941_Test_2() {
        MT941Creator mt941Creator = new MT941Creator("941");
        //20
        mt941Creator.setTranReferenceNum("234567");
        //21
        mt941Creator.setRelatedReferen("765432");
        //25
        ActnoBicAdrTagXXX accountIdentification=new ActnoBicAdrTagXXX("25");
        accountIdentification.setAcctno("1234567891");
        mt941Creator.setAccountIdentification(accountIdentification);
        //28
        mt941Creator.setStattNumSeqNum("212");
        //13D
        mt941Creator.setDateIndication("0906041515+0200");
        //60F
        DcDateCurAmtTagXXX openingBalance = new DcDateCurAmtTagXXX("60");
        openingBalance.setDcMark("C");
        openingBalance.setDate("170928");
        openingBalance.setCurrency("USD");
        openingBalance.setAmount(new BigDecimal("28000.00"));
        mt941Creator.setOpeningBalance(openingBalance);
        //62F
        DcDateCurAmtTagXXX bookBalance = new DcDateCurAmtTagXXX("62");
        bookBalance.setDcMark("C");
        bookBalance.setDate("170928");
        bookBalance.setCurrency("USD");
        bookBalance.setAmount(new BigDecimal("81767.95"));
        mt941Creator.setBookBalance(bookBalance);
        //64
        DcDateCurAmtTagXXX closingAvailableBalance = new DcDateCurAmtTagXXX("64");
        closingAvailableBalance.setDcMark("C");
        closingAvailableBalance.setDate("170928");
        closingAvailableBalance.setCurrency("USD");
        closingAvailableBalance.setAmount(new BigDecimal("81767.95"));
        mt941Creator.setClosingAvailableBalance(closingAvailableBalance);
        //65
        List<DcDateCurAmtTagXXX> list65 = new ArrayList<>();
        DcDateCurAmtTagXXX forwardAvailableBalance = new DcDateCurAmtTagXXX("65");
        forwardAvailableBalance.setDcMark("C");
        forwardAvailableBalance.setDate("170928");
        forwardAvailableBalance.setCurrency("USD");
        forwardAvailableBalance.setAmount(new BigDecimal("81767.95"));
        list65.add(forwardAvailableBalance);
        list65.add(forwardAvailableBalance);
        mt941Creator.setForwardAvailableBalance(list65);
        //90D
        DcDateCurAmtTagXXX numberAndSumOfEntriesD = new DcDateCurAmtTagXXX("90D");
        numberAndSumOfEntriesD.setNumber(111);
        numberAndSumOfEntriesD.setCurrency("USD");
        numberAndSumOfEntriesD.setAmount(new BigDecimal("81767.95"));
        mt941Creator.setNumberAndSumOfEntriesD(numberAndSumOfEntriesD);
        //90D
        DcDateCurAmtTagXXX numberAndSumOfEntriesC = new DcDateCurAmtTagXXX("90C");
        numberAndSumOfEntriesD.setNumber(111);
        numberAndSumOfEntriesC.setCurrency("USD");
        numberAndSumOfEntriesC.setAmount(new BigDecimal("81767.95"));
        mt941Creator.setNumberAndSumOfEntriesC(numberAndSumOfEntriesC);
        //86
        mt941Creator.setInfoAccontOwner("PRIME RATE AS OF TODAY 11 PCT");
        MtResult mtResult = MtCreatorManager.packMT(mt941Creator);
    }
    @Test
    public void mt941_Test_3() {
        MT941Creator mt941Creator = new MT941Creator("941");
        //20
        mt941Creator.setTranReferenceNum("234567");
        //21
        mt941Creator.setRelatedReferen("765432");
        //25
        ActnoBicAdrTagXXX accountIdentification=new ActnoBicAdrTagXXX("25");
        accountIdentification.setAcctno("1234567891");
        mt941Creator.setAccountIdentification(accountIdentification);
        //28
        mt941Creator.setStattNumSeqNum("212");
        //13D
        mt941Creator.setDateIndication("0906041515+0200");
        //60F
        DcDateCurAmtTagXXX openingBalance = new DcDateCurAmtTagXXX("60");
        openingBalance.setDcMark("CDASDAS");
        openingBalance.setDate("170928");
        openingBalance.setCurrency("USD");
        openingBalance.setAmount(new BigDecimal("28000.00"));
        mt941Creator.setOpeningBalance(openingBalance);
        //62F
        DcDateCurAmtTagXXX bookBalance = new DcDateCurAmtTagXXX("62");
        bookBalance.setDcMark("CASDAS");
        bookBalance.setDate("170928");
        bookBalance.setCurrency("USD");
        bookBalance.setAmount(new BigDecimal("81767.95"));
        mt941Creator.setBookBalance(bookBalance);
        //64
        DcDateCurAmtTagXXX closingAvailableBalance = new DcDateCurAmtTagXXX("64");
        closingAvailableBalance.setDcMark("C");
        closingAvailableBalance.setDate("17092DDSAD8");
        closingAvailableBalance.setCurrency("USDDASD");
        closingAvailableBalance.setAmount(new BigDecimal("81767.95"));
        mt941Creator.setClosingAvailableBalance(closingAvailableBalance);
        //65
        List<DcDateCurAmtTagXXX> list65 = new ArrayList<>();
        DcDateCurAmtTagXXX forwardAvailableBalance = new DcDateCurAmtTagXXX("65");
        forwardAvailableBalance.setDcMark("C");
        forwardAvailableBalance.setDate("170928");
        forwardAvailableBalance.setCurrency("USD");
        forwardAvailableBalance.setAmount(new BigDecimal("81767.95"));
        list65.add(forwardAvailableBalance);
        list65.add(forwardAvailableBalance);
        mt941Creator.setForwardAvailableBalance(list65);
        //90D
        DcDateCurAmtTagXXX numberAndSumOfEntriesD = new DcDateCurAmtTagXXX("90D");
        numberAndSumOfEntriesD.setNumber(111);
        numberAndSumOfEntriesD.setCurrency("USD");
        numberAndSumOfEntriesD.setAmount(new BigDecimal("81767.95"));
        mt941Creator.setNumberAndSumOfEntriesD(numberAndSumOfEntriesD);
        //90D
        DcDateCurAmtTagXXX numberAndSumOfEntriesC = new DcDateCurAmtTagXXX("90C");
        numberAndSumOfEntriesD.setNumber(111);
        numberAndSumOfEntriesC.setCurrency("USD");
        numberAndSumOfEntriesC.setAmount(new BigDecimal("81767.95"));
        mt941Creator.setNumberAndSumOfEntriesC(numberAndSumOfEntriesC);
        //86
        mt941Creator.setInfoAccontOwner("PRIME RATE AS OF TODAY 11 PCT");
        MtResult mtResult = MtCreatorManager.packMT(mt941Creator);
    }
    @Test
    public void mt941_Test_4() {
        MT941Creator mt941Creator = new MT941Creator("941");
        //20
        mt941Creator.setTranReferenceNum("234567");
        //21
        mt941Creator.setRelatedReferen("765432");
        //25
        ActnoBicAdrTagXXX accountIdentification=new ActnoBicAdrTagXXX("25");
        accountIdentification.setAcctno("1234567891");
        accountIdentification.setBic("PSBCCNBJ");
        mt941Creator.setAccountIdentification(accountIdentification);
        //28
        mt941Creator.setStattNumSeqNum("212");
        //13D
        mt941Creator.setDateIndication("0906041515+0200");
        //60F
        DcDateCurAmtTagXXX openingBalance = new DcDateCurAmtTagXXX("60");
        openingBalance.setDcMark("C");
        openingBalance.setDate("170928");
        openingBalance.setCurrency("EUR");
        openingBalance.setAmount(new BigDecimal("28000.00"));
        mt941Creator.setOpeningBalance(openingBalance);
        //62F
        DcDateCurAmtTagXXX bookBalance = new DcDateCurAmtTagXXX("62");
        bookBalance.setDcMark("C");
        bookBalance.setDate("170928");
        bookBalance.setCurrency("USD");
        bookBalance.setAmount(new BigDecimal("81767.95"));
        mt941Creator.setBookBalance(bookBalance);
        //64
        DcDateCurAmtTagXXX closingAvailableBalance = new DcDateCurAmtTagXXX("64");
        closingAvailableBalance.setDcMark("C");
        closingAvailableBalance.setDate("170928");
        closingAvailableBalance.setCurrency("USD");
        closingAvailableBalance.setAmount(new BigDecimal("81767.95"));
        mt941Creator.setClosingAvailableBalance(closingAvailableBalance);
        //65
        List<DcDateCurAmtTagXXX> list65 = new ArrayList<>();
        DcDateCurAmtTagXXX forwardAvailableBalance = new DcDateCurAmtTagXXX("65");
        forwardAvailableBalance.setDcMark("C");
        forwardAvailableBalance.setDate("170928");
        forwardAvailableBalance.setCurrency("USD");
        forwardAvailableBalance.setAmount(new BigDecimal("81767.95"));
        list65.add(forwardAvailableBalance);
        list65.add(forwardAvailableBalance);
        mt941Creator.setForwardAvailableBalance(list65);
        //90D
        DcDateCurAmtTagXXX numberAndSumOfEntriesD = new DcDateCurAmtTagXXX("90D");
        numberAndSumOfEntriesD.setNumber(111);
        numberAndSumOfEntriesD.setCurrency("USD");
        numberAndSumOfEntriesD.setAmount(new BigDecimal("81767.95"));
        mt941Creator.setNumberAndSumOfEntriesD(numberAndSumOfEntriesD);
        //90D
        DcDateCurAmtTagXXX numberAndSumOfEntriesC = new DcDateCurAmtTagXXX("90C");
        numberAndSumOfEntriesC.setNumber(11111);
        numberAndSumOfEntriesC.setCurrency("USD");
        numberAndSumOfEntriesC.setAmount(new BigDecimal("81767.95"));
        mt941Creator.setNumberAndSumOfEntriesC(numberAndSumOfEntriesC);
        //86
        mt941Creator.setInfoAccontOwner("PRIME RATE AS OF TODAY 11 PCT");
        MtResult mtResult = MtCreatorManager.packMT(mt941Creator);
    }
}
