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

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.mt9xx.mt9XXAbsCreator.MT973AbsCreator;
import com.brilliance.isc.swift.objmtconvert.model.mt9xx.tag.tag973.Tag20Creator;
import com.brilliance.isc.swift.objmtconvert.model.mt9xx.tag.tag973.TagCycleCreator;
import com.brilliance.isc.swift.objmtconvert.result.MtResult;

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

/**
 * @author hedonghao
 * @date 2023/2/24
 */
public class MT973Creator extends AbsMTCreator {
    @Status("M")
    @TagName("20")
    @FieldDescription("Transaction Reference Number")
    @TagRegex("16x")
    //20
    private String tranReferenceNum;
    //循环域
    private List<MT973AbsCreator> cycleDomain;
    //


    public List<MT973AbsCreator> getCycleDomain() {
        return cycleDomain;
    }

    public void setCycleDomain(List<MT973AbsCreator> cycleDomain) {
        this.cycleDomain = cycleDomain;
    }

    public MT973Creator(String msgType) throws Exception {
        super(msgType);
    }

    public MT973Creator() {
        super();
    }

    public String getTranReferenceNum() {
        return tranReferenceNum;
    }

    public void setTranReferenceNum(String tranReferenceNum) {
        this.tranReferenceNum = tranReferenceNum;
    }





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


}
