package com.brilliance.isc.json2mx.pain00200110;

import com.brilliance.isc.swift.objmtconvert.ext.XmlDate;
import com.brilliance.isc.swift.objmtconvert.manager.CreatorManager;
import com.brilliance.isc.swift.objmtconvert.model.mx.common.*;
import com.brilliance.isc.swift.objmtconvert.model.mx.pain00200110.MXPain00200110Creator;
import com.brilliance.isc.swift.objmtconvert.result.MxResult;
import org.junit.Test;

import java.text.ParseException;
import java.util.ArrayList;

/**
 * @author : zxg
 * @data : Created in 2023/4/24
 * @description :
 */
public class Pain00200110Test {

    @Test
    public void test_Pacs010() throws ParseException {

        MXPain00200110Creator mxPain00200110Creator = new MXPain00200110Creator("pain.002.001.10");
        mxPain00200110Creator.setSenderBic("PSBCCNBJ");
        mxPain00200110Creator.setSenderNm("zs");
        mxPain00200110Creator.setReceiverBic("PSBCCNBJ");
        mxPain00200110Creator.setReceiverNm("lisi");
        mxPain00200110Creator.setMsgDefIdr("sadasdd");
        mxPain00200110Creator.setBizSvc("dadad");
        mxPain00200110Creator.setCreDt(new XmlDate());

        Party party = new Party();
        IdentificationPty pty = new IdentificationPty();
        OrgId orgId = new OrgId();
        orgId.setLei("AAAAAAAAAAAAAAAAAA00");
        orgId.setAnyBIC("AAAAAAAA000");
        pty.setOrgId(orgId);
        party.setId(pty);
        mxPain00200110Creator.setInitgPty(party);

        Agent agent = new Agent();
        FinInstnId finInstnId = new FinInstnId();
//        finInstnId.setNm("NM");
        finInstnId.setBicfi("AAAAAAAA111");
        ClrSysMmbId clrSysMmbId = new ClrSysMmbId();
        ClrSysId clrSysId = new ClrSysId();
        clrSysId.setCd("cd");
        clrSysMmbId.setClrSysId(clrSysId);
        clrSysMmbId.setMmbId("mmbid");
        finInstnId.setClrSysMmbId(clrSysMmbId);
        finInstnId.setLei("AAAAAAAAAAAAAAAAAA00");
        agent.setFinInstnId(finInstnId);
        mxPain00200110Creator.setFwdgAgt(agent);
        mxPain00200110Creator.setOrgnlMsgId("orgnlMsgId");
        mxPain00200110Creator.setOrgnlMsgNmId("orgnlMsgNmId");
        mxPain00200110Creator.setOrgnlCreDtTm(new XmlDate());
        mxPain00200110Creator.setOrgnlPmtInfId("orgnlPmtInfId");
        mxPain00200110Creator.setOrgnlInstrId("orgnlInstrId");
        mxPain00200110Creator.setOrgnlEndToEndId("orgnlEndToEndId");
        mxPain00200110Creator.setTxSts("txt");

        ArrayList<StsRsnInf> stsRsnInfs = new ArrayList<>();
        StsRsnInf stsRsnInf = new StsRsnInf();
        stsRsnInf.setOrgtr(party);
        Rsn2 rsn2 = new Rsn2();
        rsn2.setCd("cd");
        ArrayList<Object> list = new ArrayList<>();
        list.add("xxxxx");
        rsn2.setAddtlInf(list);
        stsRsnInf.setRns(rsn2);
        mxPain00200110Creator.setStsRsnInf(stsRsnInfs);



        mxPain00200110Creator.setType("MX");
        MxResult result = (MxResult) CreatorManager.pack(mxPain00200110Creator);
        if (result.isSuccess()){
            String message = result.getMessage();
            System.out.println("message = " + message);
        }else {
            String errorInf = result.getErrorInf();
            System.out.println("errorInf = " + errorInf);
        }
    }

}
