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

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.mt2xx.tag.tag295.Tag21Creator;
import com.brilliance.isc.swift.objmtconvert.model.mt2xx.tag.tag295.*;

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

/**
 * @author huangmengyuan
 * @create 2023/3/1
 */
public class MT295Creator extends AbsMTCreator {
    @Status("M")
    @TagName("20")
    @FieldDescription("Transaction Reference Number")
    @TagRegex("16x")
    //20
    private String transactionReferenceNumber;
    @Status("M")
    @TagName("21")
    @FieldDescription("Related Reference")
    @TagRegex("16x")
    //21
    private String relatedReference;
    @Status("O")
    @TagName("75")
    @FieldDescription("Queries")
    @TagRegex("6*35x")
    //75
    private String queries;
    @Status("O")
    @TagName("77A")
    @FieldDescription("Narrative")
    @TagRegex("20*35x")
    //77A
    private String narrative;
    @Status("M")
    @TagName("11S")
    @FieldDescription("MT and Date of the Original Message")
    @TagRegex("3!n<crlf>6!n<crlf>[4!n6!n]")
    //11s
    private String mtandDate;

    //11r
    @Status("O")
    @TagName("11R")
    @FieldDescription("MT and Date of the Original Message")
    @TagRegex("3!n<crlf>6!n<crlf>[4!n6!n]")
    private String mtAndDateoftheOriginalMessage;

    @Status("O")
    @TagName("79")
    @FieldDescription("Narrative Description of the Original Message")
    @TagRegex("35*50x")
    //79
    private String narrativeDescriptionofQueryRelates;


    public String getTransactionReferenceNumber() {
        return transactionReferenceNumber;
    }

    public void setTransactionReferenceNumber(String transactionReferenceNumber) {
        this.transactionReferenceNumber = transactionReferenceNumber;
    }

    public String getRelatedReference() {
        return relatedReference;
    }

    public void setRelatedReference(String relatedReference) {
        this.relatedReference = relatedReference;
    }

    public String getQueries() {
        return queries;
    }

    public void setQueries(String queries) {
        this.queries = queries;
    }

    public String getNarrative() {
        return narrative;
    }

    public void setNarrative(String narrative) {
        this.narrative = narrative;
    }

    public String getMtAndDateoftheOriginalMessage() {
        return mtAndDateoftheOriginalMessage;
    }

    public void setMtAndDateoftheOriginalMessage(String mtAndDateoftheOriginalMessage) {
        this.mtAndDateoftheOriginalMessage = mtAndDateoftheOriginalMessage;
    }

    public String getMtandDate() {
        return mtandDate;
    }

    public void setMtandDate(String mtandDate) {
        this.mtandDate = mtandDate;
    }

    public String getNarrativeDescriptionofQueryRelates() {
        return narrativeDescriptionofQueryRelates;
    }

    public void setNarrativeDescriptionofQueryRelates(String narrativeDescriptionofQueryRelates) {
        this.narrativeDescriptionofQueryRelates = narrativeDescriptionofQueryRelates;
    }



    public MT295Creator(String msgType) {
        super(msgType);
    }

    public MT295Creator() {
        super("295");
    }

    @Override
    public void pack() {
       // MtResult mtResult = new MtResult();
        List<AbsTagCreate> tagCreateList=new ArrayList<>();
        try{
            tagCreateList.add(new Tag20Creator(this));
            tagCreateList.add(new Tag21Creator(this));
            tagCreateList.add(new Tag75Creator(this));
            tagCreateList.add(new Tag77ACreator(this));
            tagCreateList.add(new Tag11sCreator(this));
            tagCreateList.add(new Tag11rCreator(this));
            tagCreateList.add(new Tag79Creator(this));

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

        // return mtResult;

    }
}
