package com.brilliance.isc.swift.objmtconvert.model.mt4xx;

import com.brilliance.isc.swift.objmtconvert.annotation.FieldDescription;
import com.brilliance.isc.swift.objmtconvert.annotation.Status;
import com.brilliance.isc.swift.objmtconvert.annotation.TagName;
import com.brilliance.isc.swift.objmtconvert.annotation.TagRegex;
import com.brilliance.isc.swift.objmtconvert.model.AbsMTCreator;
import com.brilliance.isc.swift.objmtconvert.model.AbsTagCreate;
import com.brilliance.isc.swift.objmtconvert.model.mt4xx.mt4XXAbsCreator.MT412AbsCreator;
import com.brilliance.isc.swift.objmtconvert.model.mt4xx.tag.tag412.Tag72Creator;
import com.brilliance.isc.swift.objmtconvert.model.mt4xx.tag.tag412.TagCycleCreator;
import com.brilliance.isc.swift.objmtconvert.result.MtResult;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zh
 * @create 2023-02-27-17:28
 */
public class MT412Creator extends AbsMTCreator {

    private List<MT412AbsCreator> mt412AbsCreators;

    @Status("O")
    @TagName("72")
    @FieldDescription("Sender to Receiver Information")
    @TagRegex("6*35x")
    private String senderToReceiverInformation;

    public List<MT412AbsCreator> getMt412AbsCreators() {
        return mt412AbsCreators;
    }

    public void setMt412AbsCreators(List<MT412AbsCreator> mt412AbsCreators) {
        this.mt412AbsCreators = mt412AbsCreators;
    }

    public String getSenderToReceiverInformation() {
        return senderToReceiverInformation;
    }

    public void setSenderToReceiverInformation(String senderToReceiverInformation) {
        this.senderToReceiverInformation = senderToReceiverInformation;
    }
    public MT412Creator(String msgType)  {
    super(msgType);
}

    public MT412Creator() {
        super();
    }


    /**
     * 需要编写组装报文逻辑，调用set方法即可
     *
     * @return
     */
    public void pack() {
     //   MtResult mtResult = new MtResult();
        List<AbsTagCreate> tagCreateList=new ArrayList<>();
        try {
            tagCreateList.add(new TagCycleCreator(this));
            tagCreateList.add(new Tag72Creator(this));
            dealTags(tagCreateList);

            mtResult.setMessage(abstractMT.message());
        } catch (Exception e) {
            e.printStackTrace();
            mtResult.setSuccess(false);
            mtResult.addDescription(e.getLocalizedMessage());
        }

        //  return mtResult;

    }

    public MtResult unpack() {
        return null;
    }
}
