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

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

public class MT742Creator extends AbsMTCreator {
    @Status("M")
    @TagName("20")
    @FieldDescription("Claiming Bank's Reference")
    @TagRegex("16x")
    //20
    private String claimingBankReference;
    @Status("M")
    @TagName("21")
    @FieldDescription("Documentary Credit Number")
    @TagRegex("16x")
    //21
    private String documentaryCreditNumber;
    @Status("O")
    @TagName("31C")
    @FieldDescription("Date of Issue")
    @TagRegex("6!n")
    //31C
    private String dateofIssue;
    @Status("M")
    @TagName({"52A","52D"})
    @FieldDescription("Issuing Bank")
    @TagRegex({"[/1!a][/34x]<crlf>4!a2!a2!c[3!c]","[/1!a][/34x]<crlf>4*35x"})
    //52a
    private ActnoBicAdrTagXXX issuingBank;
    @Status("M")
    @TagName("32B")
    @FieldDescription("Principal Amount Claimed")
    @TagRegex("3!a15d")
    //32B
    private DcDateCurAmtTagXXX principalAmountClaimed;
    @Status("O")
    @TagName("33B")
    @FieldDescription("Additional Amount Claimed as Allowed for in Excess of Principal Amount")
    @TagRegex("3!a15d")
    //33B
    private DcDateCurAmtTagXXX additionalAmountClaimed;
    @Status("O")
    @TagName("71D")
    @FieldDescription("Charges")
    @TagRegex("6*35z")
    //71D
    private ActnoBicAdrTagXXX charges;
    @Status("M")
    @TagName({"34A","34B"})
    @FieldDescription("Total Amount Claimed")
    @TagRegex({"6!n3!a15d","3!a15d"})
    //34a
    private DcDateCurAmtTagXXX totalAmountClaimed;
    @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({"58A","58D"})
    @FieldDescription("Beneficiary Bank")
    @TagRegex({"[/1!a][/34x]<crlf>4!a2!a2!c[3!c]","[/1!a][/34x]<crlf>4*35x"})
    //58a
    private ActnoBicAdrTagXXX beneficiaryBank;
    @Status("O")
    @TagName("72Z")
    @FieldDescription("Sender to Receiver Information")
    @TagRegex("6*35z")
    //72Z
    private ActnoBicAdrTagXXX sendertoReceiverInformation;

    //20
    public String getClaimingBankReference() {
        return claimingBankReference;
    }

    public void setClaimingBankReference(String claimingBankReference) {
        this.claimingBankReference = claimingBankReference;
    }

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

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

    //31C
    public String getDateofIssue() {
        return dateofIssue;
    }

    public void setDateofIssue(String dateofIssue) {
        this.dateofIssue = dateofIssue;
    }

    //52a
    public ActnoBicAdrTagXXX getIssuingBank() {
        return issuingBank;
    }

    public void setIssuingBank(ActnoBicAdrTagXXX issuingBank) {
        this.issuingBank = issuingBank;
    }

    //32B
    public DcDateCurAmtTagXXX getPrincipalAmountClaimed() {
        return principalAmountClaimed;
    }

    public void setPrincipalAmountClaimed(DcDateCurAmtTagXXX principalAmountClaimed) {
        this.principalAmountClaimed = principalAmountClaimed;
    }

    //33B
    public DcDateCurAmtTagXXX getAdditionalAmountClaimed() {
        return additionalAmountClaimed;
    }

    public void setAdditionalAmountClaimed(DcDateCurAmtTagXXX additionalAmountClaimed) {
        this.additionalAmountClaimed = additionalAmountClaimed;
    }

    //71D
    public ActnoBicAdrTagXXX getCharges() {
        return charges;
    }

    public void setCharges(ActnoBicAdrTagXXX charges) {
        this.charges = charges;
    }

    //34a
    public DcDateCurAmtTagXXX getTotalAmountClaimed() {
        return totalAmountClaimed;
    }

    public void setTotalAmountClaimed(DcDateCurAmtTagXXX totalAmountClaimed) {
        this.totalAmountClaimed = totalAmountClaimed;
    }

    //57a
    public ActnoBicAdrTagXXX getAccountWithBank() {
        return accountWithBank;
    }

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

    //58a
    public ActnoBicAdrTagXXX getBeneficiaryBank() {
        return beneficiaryBank;
    }

    public void setBeneficiaryBank(ActnoBicAdrTagXXX beneficiaryBank) {
        this.beneficiaryBank = beneficiaryBank;
    }

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

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


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

    public MT742Creator() {
        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 Tag31CCreator(this));
            tagCreateList.add(new Tag52aCreator(this));
            tagCreateList.add(new Tag32BCreator(this));
            tagCreateList.add(new Tag33BCreator(this));
            tagCreateList.add(new Tag71DCreator(this));
            tagCreateList.add(new Tag34aCreator(this));
            tagCreateList.add(new Tag57aCreator(this));
            tagCreateList.add(new Tag58aCreator(this));
            tagCreateList.add(new Tag72ZCreator(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;
    }

}

