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.tag750.*;
import com.brilliance.isc.swift.objmtconvert.result.MtResult;
import java.util.ArrayList;
import java.util.List;

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

public class MT750Creator extends AbsMTCreator {

    @Status("M")
    @TagName("20")
    @FieldDescription("Sender's Reference")
    @TagRegex("16x")
    //20
    private String sendersReference;

    @Status("M")
    @TagName("21")
    @FieldDescription("Related Reference")
    @TagRegex("16x")
    //21
    private String relatedReference;

    @Status("M")
    @TagName("32B")
    @FieldDescription("Principal Amount")
    @TagRegex("3!a15d")
    //32B
    private DcDateCurAmtTagXXX principalAmount;

    @Status("O")
    @TagName("33B")
    @FieldDescription("Additional Amount")
    @TagRegex("3!a15d")
    //33B
    private DcDateCurAmtTagXXX additionalAmount;

    @Status("O")
    @TagName("71D")
    @FieldDescription("Charges to be Deducted")
    @TagRegex("6*35z")
    //71D
    private ActnoBicAdrTagXXX chargestobeDeducted;

    @Status("O")
    @TagName("73A")
    @FieldDescription("Charges to be Added")
    @TagRegex("6*35z")
    //73A
    private ActnoBicAdrTagXXX chargestobeAdded;

    @Status("O")
    @TagName("34B")
    @FieldDescription("Total Amount to be Paid")
    @TagRegex("3!a15d")
    //34B
    private DcDateCurAmtTagXXX totalAmounttobePaid;

    @Status("O")
    @TagName({"57A","57B","57D"})
    @FieldDescription("Account With Bank")
    @TagRegex({"[/1!a][/34x]<crlf>4!a2!a2!c[3!c]","[/1!a][/34x]<crlf>[35x]","[/1!a][/34x]<crlf>4*35x"})
    //57a
    private ActnoBicAdrTagXXX accountWithBank;

    @Status("O")
    @TagName("72Z")
    @FieldDescription("Sender to Receiver Information")
    @TagRegex("6*35z")
    //72Z
    private ActnoBicAdrTagXXX sendertoReceiverInformation;

    @Status("M")
    @TagName("77J")
    @FieldDescription("Discrepancies")
    @TagRegex("70*50z")
    //77J
    private ActnoBicAdrTagXXX discrepancies;

    public String getSendersReference() {
        return sendersReference;
    }

    public void setSendersReference(String sendersReference) {
        this.sendersReference = sendersReference;
    }

    public String getRelatedReference() {
        return relatedReference;
    }

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

    public DcDateCurAmtTagXXX getPrincipalAmount() {
        return principalAmount;
    }

    public void setPrincipalAmount(DcDateCurAmtTagXXX principalAmount) {
        this.principalAmount = principalAmount;
    }

    public DcDateCurAmtTagXXX getAdditionalAmount() {
        return additionalAmount;
    }

    public void setAdditionalAmount(DcDateCurAmtTagXXX additionalAmount) {
        this.additionalAmount = additionalAmount;
    }

    public ActnoBicAdrTagXXX getChargestobeDeducted() {
        return chargestobeDeducted;
    }

    public void setChargestobeDeducted(ActnoBicAdrTagXXX chargestobeDeducted) {
        this.chargestobeDeducted = chargestobeDeducted;
    }

    public ActnoBicAdrTagXXX getChargestobeAdded() {
        return chargestobeAdded;
    }

    public void setChargestobeAdded(ActnoBicAdrTagXXX chargestobeAdded) {
        this.chargestobeAdded = chargestobeAdded;
    }

    public DcDateCurAmtTagXXX getTotalAmounttobePaid() {
        return totalAmounttobePaid;
    }

    public void setTotalAmounttobePaid(DcDateCurAmtTagXXX totalAmounttobePaid) {
        this.totalAmounttobePaid = totalAmounttobePaid;
    }

    public ActnoBicAdrTagXXX getAccountWithBank() {
        return accountWithBank;
    }

    public void setAccountWithBank(ActnoBicAdrTagXXX accountWithBank) {
        this.accountWithBank = accountWithBank;
    }

    public ActnoBicAdrTagXXX getSendertoReceiverInformation() {
        return sendertoReceiverInformation;
    }

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

    public ActnoBicAdrTagXXX getDiscrepancies() {
        return discrepancies;
    }

    public void setDiscrepancies(ActnoBicAdrTagXXX discrepancies) {
        this.discrepancies = discrepancies;
    }

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

    public MT750Creator() {
        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 Tag32BCreator(this));
            tagCreateList.add(new Tag33BCreator(this));
            tagCreateList.add(new Tag71DCreator(this));
            tagCreateList.add(new Tag73ACreator(this));
            tagCreateList.add(new Tag34BCreator(this));
            tagCreateList.add(new Tag57aCreator(this));
            tagCreateList.add(new Tag72ZCreator(this));
            tagCreateList.add(new Tag77JCreator(this));
            dealTags(tagCreateList);

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

       // return mtResult;

    }

    public MtResult unpack() {
        return null;
    }

}

