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

/**
 * @author wuzhe
 * @date 2023/2/28
 */

public class MT720Creator extends AbsMTCreator {
    @Status("M")
    @TagName("27")
    @FieldDescription("Sequence of Total")
    @TagRegex("1!n/1!n")
    //27
    private String sequenceofTotal;
    @Status("M")
    @TagName("40B")
    @FieldDescription("Form of Documentary Credit")
    @TagRegex("24x<crlf>24x")
    //40B
    private ActnoBicAdrTagXXX formofDocumentaryCredit;
    @Status("M")
    @TagName("20")
    @FieldDescription("Transferring Bank's Reference")
    @TagRegex("16x")
    //20
    private String transferringBankReference;
    @Status("M")
    @TagName("21")
    @FieldDescription("Documentary Credit Number")
    @TagRegex("16x")
    //21
    private String documentaryCreditNumber;
    @Status("M")
    @TagName("31C")
    @FieldDescription("Date of Issue")
    @TagRegex("6!n")
    //31C
    private String dateofIssue;
    @Status("M")
    @TagName("40E")
    @FieldDescription("Applicable Rules")
    @TagRegex("30x[/35x]")
    //40E
    private String applicableRules;
    @Status("M")
    @TagName("31D")
    @FieldDescription("Date and Place of Expiry")
    @TagRegex("6!n29x")
    //31D
    private String dateandPlaceofExpiry;
    @Status("O")
    @TagName({"52A","52D"})
    @FieldDescription("Issuing Bank of the Original Documentary Credit")
    @TagRegex({"[/1!a][/34x]<crlf>4!a2!a2!c[3!c]","[/1!a][/34x]<crlf>4*35x"})
    //52a
    private ActnoBicAdrTagXXX issuingBankoftheOriginalDocumentaryCredit;
    @Status("O")
    @TagName("50B")
    @FieldDescription("Non-Bank Issuer of the Original Documentary Credit")
    @TagRegex("4*35x")
    //50B
    private String nonBankIssueroftheOriginalDocumentaryCredit;
    @Status("M")
    @TagName("50")
    @FieldDescription("First Beneficiary")
    @TagRegex("4*35x")
    //50
    private String firstBeneficiary;
    @Status("M")
    @TagName("59")
    @FieldDescription("Second Beneficiary")
    @TagRegex("[/34x]<crlf>4*35x")
    //59
    private ActnoBicAdrTagXXX secondBeneficiary;
    @Status("M")
    @TagName("32B")
    @FieldDescription("Currency Code, Amount")
    @TagRegex("3!a15d")
    //32B
    private DcDateCurAmtTagXXX currencyCodeAmount;
    @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("M")
    @TagName({"41A","41D"})
    @FieldDescription("Available With ... By ...")
    @TagRegex({"4!a2!a2!c[3!c]<crlf>14x","4*35x<crlf>14x"})
    //41a
    private ActnoBicAdrTagXXX available;
    @Status("O")
    @TagName("42C")
    @FieldDescription("Drafts at ...")
    @TagRegex("3*35x")
    //42C
    private String draftsat;
    @Status("O")
    @TagName({"42A","42D"})
    @FieldDescription("Drawee")
    @TagRegex({"[/1!a][/34x]<crlf>4!a2!a2!c[3!c]","[/1!a][/34x]<crlf>4*35x"})
    //42a
    private ActnoBicAdrTagXXX drawee;
    @Status("O")
    @TagName("42M")
    @FieldDescription("Mixed Payment Details")
    @TagRegex("4*35x")
    //42M
    private String mixedPaymentDetails;
    @Status("O")
    @TagName("42P")
    @FieldDescription("Negotiation/Deferred Payment Details")
    @TagRegex("4*35x")
    //42P
    private String negotiationDeferredPaymentDetails;
    @Status("O")
    @TagName("43P")
    @FieldDescription("Partial Shipments")
    @TagRegex("11x")
    //43P
    private String partialShipments;
    @Status("O")
    @TagName("43T")
    @FieldDescription("Transhipment")
    @TagRegex("11x")
    //43T
    private String transhipment;
    @Status("O")
    @TagName("44A")
    @FieldDescription("Place of Taking in Charge/Dispatch from .../Place of Receipt")
    @TagRegex("65x")
    //44A
    private String placeofTakinginCharge;
    @Status("O")
    @TagName("44E")
    @FieldDescription("Port of Loading/Airport of Departure")
    @TagRegex("65x")
    //44E
    private String portofLoadingAirportofDeparture;
    @Status("O")
    @TagName("44F")
    @FieldDescription("Port of Discharge/Airport of Destination")
    @TagRegex("65x")
    //44F
    private String portofDischargeAirportofDestination;
    @Status("O")
    @TagName("44B")
    @FieldDescription("Place of Final Destination/For Transportation to .../Place of Delivery")
    @TagRegex("65x")
    //44B
    private String placeofFinalDestination;
    @Status("O")
    @TagName("44C")
    @FieldDescription("Latest Date of Shipment")
    @TagRegex("6!n")
    //44C
    private String latestDateofShipment;
    @Status("O")
    @TagName("44D")
    @FieldDescription("Shipment Period")
    @TagRegex("6*65x")
    //44D
    private String shipmentPeriod;
    @Status("O")
    @TagName("45A")
    @FieldDescription("Description of Goods and/or Services")
    @TagRegex("100*65z")
    //45A
    private String descriptionofGoodsServices;
    @Status("O")
    @TagName("46A")
    @FieldDescription("Documents Required")
    @TagRegex("100*65z")
    //46A
    private String documentsRequired;
    @Status("O")
    @TagName("47A")
    @FieldDescription("Additional Conditions")
    @TagRegex("100*65z")
    //47A
    private String additionalConditions;
    @Status("O")
    @TagName("49G")
    @FieldDescription("Special Payment Conditions for Beneficiary")
    @TagRegex("100*65z")
    //49G
    private String specialPaymentConditionsforBeneficiary;
    @Status("O")
    @TagName("49H")
    @FieldDescription("Special Payment Conditions for Bank Only")
    @TagRegex("100*65z")
    //49H
    private String specialPaymentConditionsforBankOnly;
    @Status("O")
    @TagName("71D")
    @FieldDescription("Charges")
    @TagRegex("6*35z")
    //71D
    private ActnoBicAdrTagXXX charges;
    //private String charges;
    @Status("O")
    @TagName("48")
    @FieldDescription("Period for Presentation in Days")
    @TagRegex("3n[/35x]")
    //48
    private String periodforPresentationinDays;
    @Status("M")
    @TagName("49")
    @FieldDescription("Confirmation Instructions")
    @TagRegex("7!x")
    //49
    private String confirmationInstructions;
    @Status("O")
    @TagName({"58A","58D"})
    @FieldDescription("Requested Confirmation Party")
    @TagRegex({"[/1!a][/34x]<crlf>4!a2!a2!c[3!c]","[/1!a][/34x]<crlf>4*35x"})
    //58a
    private ActnoBicAdrTagXXX requestedConfirmationParty;
    @Status("O")
    @TagName("78")
    @FieldDescription("Instructions to the Paying/Accepting/Negotiating Bank")
    @TagRegex("12*65x")
    //78
    private String instructionstothePayingAcceptingNegotiatingBank;
    @Status("O")
    @TagName("78D")
    @FieldDescription("Instructions to Intermediary Bank")
    @TagRegex("12*65x")
    //78D
    private String instructionstoIntermediaryBank;

    @Status("O")
    @TagName({"57A","57B","57D"})
    @FieldDescription("'Advise Through' 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 adviseThroughBank;
    @Status("O")
    @TagName("72Z")
    @FieldDescription("Sender to Receiver Information")
    @TagRegex("6*35z")
    //72Z
    private ActnoBicAdrTagXXX sendertoReceiverInformation;

    //27
    public String getSequenceofTotal() {
        return sequenceofTotal;
    }

    public void setSequenceofTotal(String sequenceofTotal) {
        this.sequenceofTotal = sequenceofTotal;
    }

    //40B
    public ActnoBicAdrTagXXX getFormofDocumentaryCredit() {
        return formofDocumentaryCredit;
    }

    public void setFormofDocumentaryCredit(ActnoBicAdrTagXXX formofDocumentaryCredit) {
        this.formofDocumentaryCredit = formofDocumentaryCredit;
    }

    //20
    public String getTransferringBankReference() {
        return transferringBankReference;
    }

    public void setTransferringBankReference(String transferringBankReference) {
        this.transferringBankReference = transferringBankReference;
    }

    //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;
    }

    //40E
    public String getApplicableRules() {
        return applicableRules;
    }

    public void setApplicableRules(String applicableRules) {
        this.applicableRules = applicableRules;
    }

    //31D
    public String getDateandPlaceofExpiry() {
        return dateandPlaceofExpiry;
    }

    public void setDateandPlaceofExpiry(String dateandPlaceofExpiry) {
        this.dateandPlaceofExpiry = dateandPlaceofExpiry;
    }

    //52a
    public ActnoBicAdrTagXXX getIssuingBankoftheOriginalDocumentaryCredit() {
        return issuingBankoftheOriginalDocumentaryCredit;
    }

    public void setIssuingBankoftheOriginalDocumentaryCredit(ActnoBicAdrTagXXX issuingBankoftheOriginalDocumentaryCredit) {
        this.issuingBankoftheOriginalDocumentaryCredit = issuingBankoftheOriginalDocumentaryCredit;
    }

    //50B
    public String getNonBankIssueroftheOriginalDocumentaryCredit() {
        return nonBankIssueroftheOriginalDocumentaryCredit;
    }

    public void setNonBankIssueroftheOriginalDocumentaryCredit(String nonBankIssueroftheOriginalDocumentaryCredit) {
        this.nonBankIssueroftheOriginalDocumentaryCredit = nonBankIssueroftheOriginalDocumentaryCredit;
    }

    //50
    public String getFirstBeneficiary() {
        return firstBeneficiary;
    }

    public void setFirstBeneficiary(String firstBeneficiary) {
        this.firstBeneficiary = firstBeneficiary;
    }

    //59
    public ActnoBicAdrTagXXX getSecondBeneficiary() {
        return secondBeneficiary;
    }

    public void setSecondBeneficiary(ActnoBicAdrTagXXX secondBeneficiary) {
        this.secondBeneficiary = secondBeneficiary;
    }

    //32B
    public DcDateCurAmtTagXXX getCurrencyCodeAmount() {
        return currencyCodeAmount;
    }

    public void setCurrencyCodeAmount(DcDateCurAmtTagXXX currencyCodeAmount) {
        this.currencyCodeAmount = currencyCodeAmount;
    }

    //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;
    }

    //41a
    public ActnoBicAdrTagXXX getAvailable() {
        return available;
    }

    public void setAvailable(ActnoBicAdrTagXXX available) {
        this.available = available;
    }

    //42C
    public String getDraftsat() {
        return draftsat;
    }

    public void setDraftsat(String draftsat) {
        this.draftsat = draftsat;
    }

    //42a
    public ActnoBicAdrTagXXX getDrawee() {
        return drawee;
    }

    public void setDrawee(ActnoBicAdrTagXXX drawee) {
        this.drawee = drawee;
    }

    //42M
    public String getMixedPaymentDetails() {
        return mixedPaymentDetails;
    }

    public void setMixedPaymentDetails(String mixedPaymentDetails) {
        this.mixedPaymentDetails = mixedPaymentDetails;
    }

    //42P
    public String getNegotiationDeferredPaymentDetails() {
        return negotiationDeferredPaymentDetails;
    }

    public void setNegotiationDeferredPaymentDetails(String negotiationDeferredPaymentDetails) {
        this.negotiationDeferredPaymentDetails = negotiationDeferredPaymentDetails;
    }

    //43P
    public String getPartialShipments() {
        return partialShipments;
    }

    public void setPartialShipments(String partialShipments) {
        this.partialShipments = partialShipments;
    }

    //43T
    public String getTranshipment() {
        return transhipment;
    }

    public void setTranshipment(String transhipment) {
        this.transhipment = transhipment;
    }

    //44A
    public String getPlaceofTakinginCharge() {
        return placeofTakinginCharge;
    }

    public void setPlaceofTakinginCharge(String placeofTakinginCharge) {
        this.placeofTakinginCharge = placeofTakinginCharge;
    }

    //44E
    public String getPortofLoadingAirportofDeparture() {
        return portofLoadingAirportofDeparture;
    }

    public void setPortofLoadingAirportofDeparture(String portofLoadingAirportofDeparture) {
        this.portofLoadingAirportofDeparture = portofLoadingAirportofDeparture;
    }

    //44F
    public String getPortofDischargeAirportofDestination() {
        return portofDischargeAirportofDestination;
    }

    public void setPortofDischargeAirportofDestination(String portofDischargeAirportofDestination) {
        this.portofDischargeAirportofDestination = portofDischargeAirportofDestination;
    }

    //44B
    public String getPlaceofFinalDestination() {
        return placeofFinalDestination;
    }

    public void setPlaceofFinalDestination(String placeofFinalDestination) {
        this.placeofFinalDestination = placeofFinalDestination;
    }

    //44C
    public String getLatestDateofShipment() {
        return latestDateofShipment;
    }

    public void setLatestDateofShipment(String latestDateofShipment) {
        this.latestDateofShipment = latestDateofShipment;
    }

    //44D
    public String getShipmentPeriod() {
        return shipmentPeriod;
    }

    public void setShipmentPeriod(String shipmentPeriod) {
        this.shipmentPeriod = shipmentPeriod;
    }

    //45A
    public String getDescriptionofGoodsServices() {
        return descriptionofGoodsServices;
    }

    public void setDescriptionofGoodsServices(String descriptionofGoodsServices) {
        this.descriptionofGoodsServices = descriptionofGoodsServices;
    }

    //46A
    public String getDocumentsRequired() {
        return documentsRequired;
    }

    public void setDocumentsRequired(String documentsRequired) {
        this.documentsRequired = documentsRequired;
    }

    //47A
    public String getAdditionalConditions() {
        return additionalConditions;
    }

    public void setAdditionalConditions(String additionalConditions) {
        this.additionalConditions = additionalConditions;
    }

    //49G
    public String getSpecialPaymentConditionsforBeneficiary() {
        return specialPaymentConditionsforBeneficiary;
    }

    public void setSpecialPaymentConditionsforBeneficiary(String specialPaymentConditionsforBeneficiary) {
        this.specialPaymentConditionsforBeneficiary = specialPaymentConditionsforBeneficiary;
    }

    //49H
    public String getSpecialPaymentConditionsforBankOnly() {
        return specialPaymentConditionsforBankOnly;
    }

    public void setSpecialPaymentConditionsforBankOnly(String specialPaymentConditionsforBankOnly) {
        this.specialPaymentConditionsforBankOnly = specialPaymentConditionsforBankOnly;
    }

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

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

    //48
    public String getPeriodforPresentationinDays() {
        return periodforPresentationinDays;
    }

    public void setPeriodforPresentationinDays(String periodforPresentationinDays) {
        this.periodforPresentationinDays = periodforPresentationinDays;
    }

    //49
    public String getConfirmationInstructions() {
        return confirmationInstructions;
    }

    public void setConfirmationInstructions(String confirmationInstructions) {
        this.confirmationInstructions = confirmationInstructions;
    }

    //58a
    public ActnoBicAdrTagXXX getRequestedConfirmationParty() {
        return requestedConfirmationParty;
    }

    public void setRequestedConfirmationParty(ActnoBicAdrTagXXX requestedConfirmationParty) {
        this.requestedConfirmationParty = requestedConfirmationParty;
    }

    //78
    public String getInstructionstothePayingAcceptingNegotiatingBank() {
        return instructionstothePayingAcceptingNegotiatingBank;
    }

    public void setInstructionstothePayingAcceptingNegotiatingBank(String instructionstothePayingAcceptingNegotiatingBank) {
        this.instructionstothePayingAcceptingNegotiatingBank = instructionstothePayingAcceptingNegotiatingBank;
    }

    //78D
    public String getInstructionstoIntermediaryBank() {
        return instructionstoIntermediaryBank;
    }

    public void setInstructionstoIntermediaryBank(String instructionstoIntermediaryBank) {
        this.instructionstoIntermediaryBank = instructionstoIntermediaryBank;
    }

    //57a
    public ActnoBicAdrTagXXX getAdviseThroughBank() {
        return adviseThroughBank;
    }

    public void setAdviseThroughBank(ActnoBicAdrTagXXX adviseThroughBank) {
        this.adviseThroughBank = adviseThroughBank;
    }

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

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

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

    public MT720Creator() {
        super("720");
    }
    /**
     * 需要编写组装报文逻辑，调用set方法即可
     *
     * @return
     */
    public void pack() {
       // MtResult mtResult = new MtResult();
        List<AbsTagCreate> tagCreateList = new ArrayList<>();
        try {
            tagCreateList.add(new Tag27Creator(this));
            tagCreateList.add(new Tag40BCreator(this));
            tagCreateList.add(new Tag20Creator(this));
            tagCreateList.add(new Tag21Creator(this));
            tagCreateList.add(new Tag31CCreator(this));
            tagCreateList.add(new Tag40ECreator(this));
            tagCreateList.add(new Tag31DCreator(this));
            tagCreateList.add(new Tag52aCreator(this));
            tagCreateList.add(new Tag50BCreator(this));
            tagCreateList.add(new Tag50Creator(this));
            tagCreateList.add(new Tag59Creator(this));
            tagCreateList.add(new Tag32BCreator(this));
            tagCreateList.add(new Tag39ACreator(this));
            tagCreateList.add(new Tag39CCreator(this));
            tagCreateList.add(new Tag41aCreator(this));
            tagCreateList.add(new Tag42CCreator(this));
            tagCreateList.add(new Tag42aCreator(this));
            tagCreateList.add(new Tag42MCreator(this));
            tagCreateList.add(new Tag42PCreator(this));
            tagCreateList.add(new Tag43PCreator(this));
            tagCreateList.add(new Tag43TCreator(this));
            tagCreateList.add(new Tag44ACreator(this));
            tagCreateList.add(new Tag44ECreator(this));
            tagCreateList.add(new Tag44FCreator(this));
            tagCreateList.add(new Tag44BCreator(this));
            tagCreateList.add(new Tag44CCreator(this));
            tagCreateList.add(new Tag44DCreator(this));
            tagCreateList.add(new Tag45ACreator(this));
            tagCreateList.add(new Tag46ACreator(this));
            tagCreateList.add(new Tag47ACreator(this));
            tagCreateList.add(new Tag49GCreator(this));
            tagCreateList.add(new Tag49HCreator(this));
            tagCreateList.add(new Tag71DCreator(this));
            tagCreateList.add(new Tag48Creator(this));
            tagCreateList.add(new Tag49Creator(this));
            tagCreateList.add(new Tag58aCreator(this));
            tagCreateList.add(new Tag78Creator(this));
            tagCreateList.add(new Tag78DCreator(this));
            tagCreateList.add(new Tag57aCreator(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;
    }

}

