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

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.commontag.ActnoBicAdrTagXXX;
import com.brilliance.isc.swift.objmtconvert.model.commontag.DcDateCurAmtTagXXX;
import com.brilliance.isc.swift.objmtconvert.model.mt7xx.tag.tag747.*;
import com.brilliance.isc.swift.objmtconvert.result.MtResult;
import java.util.ArrayList;
import java.util.List;

/**
 * @author wuzhe
 * @date 2023/3/1
 */

public class MT747Creator extends AbsMTCreator {
    @Status("M")
    @TagName("20")
    @FieldDescription("Documentary Credit Number")
    @TagRegex("16x")
    //20
    private String documentaryCreditNumber;
    @Status("O")
    @TagName("21")
    @FieldDescription("Reimbursing Bank's Reference")
    @TagRegex("16x")
    //21
    private String reimbursingBankReference;
    @Status("M")
    @TagName("30")
    @FieldDescription("Date of the Original Authorisation to Reimburse")
    @TagRegex("6!n")
    //30
    private String dateoftheOriginalAuthorisationtoReimburse;
    @Status("O")
    @TagName("31E")
    @FieldDescription("New Date of Expiry")
    @TagRegex("6!n")
    //31E
    private String newDateofExpiry;
    @Status("O")
    @TagName("32B")
    @FieldDescription("Increase of Documentary Credit Amount")
    @TagRegex("3!a15d")
    //32B
    private DcDateCurAmtTagXXX increaseofDocumentaryCreditAmount;
    @Status("O")
    @TagName("33B")
    @FieldDescription("Decrease of Documentary Credit Amount")
    @TagRegex("3!a15d")
    //33B
    private DcDateCurAmtTagXXX decreaseofDocumentaryCreditAmount;
    @Status("O")
    @TagName("34B")
    @FieldDescription("New Documentary Credit Amount After Amendment")
    @TagRegex("3!a15d")
    //34B
    private DcDateCurAmtTagXXX newDocumentaryCreditAmountAfterAmendment;
    @Status("O")
    @TagName("39A")
    @FieldDescription("Percentage Credit Amount Tolerance")
    @TagRegex("2n/2n")
    //39A
    private String percentageCreditAmountTolerance;
    @Status("O")
    @TagName("39C")
    @FieldDescription("Additional Amounts Covered")
    @TagRegex("4*35x")
    //39C
    private String additionalAmountsCovered;
    @Status("O")
    @TagName("72Z")
    @FieldDescription("Sender to Receiver Information")
    @TagRegex("6*35z")
    //72Z
    private ActnoBicAdrTagXXX sendertoReceiverInformation;
    @Status("O")
    @TagName("77")
    @FieldDescription("Narrative")
    @TagRegex("20*35z")
    //77
    private String narrative;


    //20
    public String getDocumentaryCreditNumber() {
        return documentaryCreditNumber;
    }

    public void setDocumentaryCreditNumber(String documentaryCreditNumber) {
        this.documentaryCreditNumber = documentaryCreditNumber;
    }

    //21
    public String getReimbursingBankReference() {
        return reimbursingBankReference;
    }

    public void setReimbursingBankReference(String reimbursingBankReference) {
        this.reimbursingBankReference = reimbursingBankReference;
    }

    //30
    public String getDateoftheOriginalAuthorisationtoReimburse() {
        return dateoftheOriginalAuthorisationtoReimburse;
    }

    public void setDateoftheOriginalAuthorisationtoReimburse(String dateoftheOriginalAuthorisationtoReimburse) {
        this.dateoftheOriginalAuthorisationtoReimburse = dateoftheOriginalAuthorisationtoReimburse;
    }

    //31E
    public String getNewDateofExpiry() {
        return newDateofExpiry;
    }

    public void setNewDateofExpiry(String newDateofExpiry) {
        this.newDateofExpiry = newDateofExpiry;
    }

    //32B
    public DcDateCurAmtTagXXX getIncreaseofDocumentaryCreditAmount() {
        return increaseofDocumentaryCreditAmount;
    }

    public void setIncreaseofDocumentaryCreditAmount(DcDateCurAmtTagXXX increaseofDocumentaryCreditAmount) {
        this.increaseofDocumentaryCreditAmount = increaseofDocumentaryCreditAmount;
    }

    //33B
    public DcDateCurAmtTagXXX getDecreaseofDocumentaryCreditAmount() {
        return decreaseofDocumentaryCreditAmount;
    }

    public void setDecreaseofDocumentaryCreditAmount(DcDateCurAmtTagXXX decreaseofDocumentaryCreditAmount) {
        this.decreaseofDocumentaryCreditAmount = decreaseofDocumentaryCreditAmount;
    }

    //34B
    public DcDateCurAmtTagXXX getNewDocumentaryCreditAmountAfterAmendment() {
        return newDocumentaryCreditAmountAfterAmendment;
    }

    public void setNewDocumentaryCreditAmountAfterAmendment(DcDateCurAmtTagXXX newDocumentaryCreditAmountAfterAmendment) {
        this.newDocumentaryCreditAmountAfterAmendment = newDocumentaryCreditAmountAfterAmendment;
    }

    //39A
    public String getPercentageCreditAmountTolerance() {
        return percentageCreditAmountTolerance;
    }

    public void setPercentageCreditAmountTolerance(String percentageCreditAmountTolerance) {
        this.percentageCreditAmountTolerance = percentageCreditAmountTolerance;
    }

    //39C
    public String getAdditionalAmountsCovered() {
        return additionalAmountsCovered;
    }

    public void setAdditionalAmountsCovered(String additionalAmountsCovered) {
        this.additionalAmountsCovered = additionalAmountsCovered;
    }

    //72Z
    public ActnoBicAdrTagXXX getSendertoReceiverInformation() {
        return sendertoReceiverInformation;
    }

    public void setSendertoReceiverInformation(ActnoBicAdrTagXXX sendertoReceiverInformation) {
        this.sendertoReceiverInformation = sendertoReceiverInformation;
    }

    //77
    public String getNarrative() {
        return narrative;
    }

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

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

    public MT747Creator() {
        super();
    }

    /**
     * 需要编写组装报文逻辑，调用set方法即可
     *
     * @return
     */
    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 Tag30Creator(this));
            tagCreateList.add(new Tag31ECreator(this));
            tagCreateList.add(new Tag32BCreator(this));
            tagCreateList.add(new Tag33BCreator(this));
            tagCreateList.add(new Tag34BCreator(this));
            tagCreateList.add(new Tag39ACreator(this));
            tagCreateList.add(new Tag39CCreator(this));
            tagCreateList.add(new Tag72ZCreator(this));
            tagCreateList.add(new Tag77Creator(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;
    }

}

