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

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.tag.tag940.Tag61Creator;
import com.brilliance.isc.swift.objmtconvert.model.mt9xx.tag.tag940.Tag86CycleCreator;
import com.brilliance.isc.swift.objmtconvert.result.MtResult;

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

/**
 * @author zh
 * @create 2023-02-24-16:37
 */
public class MT940AbsCreator extends AbsMTCreator {

    @Status("O")
    @TagName("61")
    @FieldDescription("Statement Line")
    @TagRegex("6!n[4!n]2a[1!a]15d1!a3!c16x[//16x]<crlf>[34x]")
    private String statementLine;
    @Status("O")
    @TagName("86")
    @FieldDescription("Information to Account Owner")
    @TagRegex("6*65x")
    private String informationToAccountOwner;

    public String getStatementLine() {
        return statementLine;
    }

    public void setStatementLine(String statementLine) {
        this.statementLine = statementLine;
    }

    public String getInformationToAccountOwner() {
        return informationToAccountOwner;
    }

    public void setInformationToAccountOwner(String informationToAccountOwner) {
        this.informationToAccountOwner = informationToAccountOwner;
    }

    public MT940AbsCreator(String jsonData) throws Exception {
        super(jsonData);
    }

    public MT940AbsCreator() {
        super();
    }

    /**
     * 需要编写组装报文逻辑，调用set方法即可
     *
     * @return
     */
    public void pack() {
       // MtResult mtResult = new MtResult();
        List<AbsTagCreate> tagCreateList=new ArrayList<>();
        try {
            dealTags(tagCreateList);
            tagCreateList.add(new Tag61Creator(this));
            tagCreateList.add(new Tag86CycleCreator(this));
            mtResult.setMessage(abstractMT.message());
        } catch (Exception e) {
            e.printStackTrace();
            mtResult.setSuccess(false);
            mtResult.addDescription(e.getLocalizedMessage());
        }

       // return mtResult;

    }
}
