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.tag710.*;
import com.brilliance.isc.swift.objmtconvert.result.MtResult;

import javax.print.attribute.standard.Destination;
import java.time.Period;
import java.util.ArrayList;
import java.util.List;

/**
 * @author gaosheng
 * @date 2023/2/28
 */
public class MT710Creator extends AbsMTCreator {

    @Status("M")
    @TagName("27")
    @FieldDescription("Sequenceof Total")
    @TagRegex("1!n/1!n")
    //27
    private String sequenceofTotal;

    @Status("M")
    @TagName("40B")
    @FieldDescription("FormofDocumentary Credit")
    @TagRegex("24x<crlf>24x")
    //40B
    private String formofDocumentaryCredit;

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

    @Status("M")
    @TagName("21")
    @FieldDescription("Documentary Credit Number")
    @TagRegex("16x")
    //21
    private String documentaryCreditNumber;

    @Status("O")
    @TagName("23")
    @FieldDescription("Referenceto PreAdvice")
    @TagRegex("16x")
    //23
    private String referencetoPreAdvice;

    @Status("M")
    @TagName("31C")
    @FieldDescription("Dateof 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("Dateand Placeof Expiry")
    @TagRegex("6!n29x")
    //31D
    private String dateandPlaceofExpiry;

    @Status("O")
    @TagName("52a")
    @FieldDescription("Issuing Bank")
    @TagRegex("A or D")
    //52a
    private ActnoBicAdrTagXXX issuingBank;

    @Status("O")
    @TagName("50B")
    @FieldDescription("NonBank Issuer")
    @TagRegex("4*35x")
    //50B
    private String nonBankIssuer;

    @Status("O")
    @TagName("51a")
    @FieldDescription("Applicant Bank")
    @TagRegex("A or D")
    //51a
    private ActnoBicAdrTagXXX applicantBank;

    @Status("M")
    @TagName("50")
    @FieldDescription("Applicant")
    @TagRegex("4*35x")
    //50
    private String applicant;

    @Status("M")
    @TagName("59")
    @FieldDescription("Beneficiary")
    @TagRegex("[/34x]<crlf>4*35x")
    //59
    private ActnoBicAdrTagXXX beneficiary;

    @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")
    @FieldDescription("Available WithBy")
    @TagRegex("A or D")
    //41a
    private ActnoBicAdrTagXXX availableWithBy;

    @Status("O")
    @TagName("42C")
    @FieldDescription("Draftsat")
    @TagRegex("3*35x")
    //42C
    private String draftsat;

    @Status("O")
    @TagName("42a")
    @FieldDescription("Drawee")
    @TagRegex("A or D")
    //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("Placeof Takingin Charge Dispatchfrom Placeof Receipt")
    @TagRegex("65x")
    //44A
    private String placeofTakinginChargeDispatchfromPlaceofReceipt;

    @Status("O")
    @TagName("44E")
    @FieldDescription("Portof Loading Airportof Departure")
    @TagRegex("65x")
    //44E
    private String portofLoadingAirportofDeparture;

    @Status("O")
    @TagName("44F")
    @FieldDescription("Portof Discharge Airportof Destination")
    @TagRegex("65x")
    //44F
    private String portofDischargeAirportofDestination;

    @Status("O")
    @TagName("44B")
    @FieldDescription("Placeof Final Destination For Transportationto PlaceofDelivery")
    @TagRegex("65x")
    //44B
    private String placeofFinalDestinationForTransportationtoPlaceofDelivery;

    @Status("O")
    @TagName("44C")
    @FieldDescription("Latest Dateof 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("Descriptionof Goodsandor Services")
    @TagRegex("100*65z")
    //45A
    private String descriptionofGoodsandorServices;

    @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 Conditionsfor 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 String charges;

    @Status("O")
    @TagName("48")
    @FieldDescription("Periodfor Presentationin 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")
    @FieldDescription("Requested Confirmation Party")
    @TagRegex("A or D")
    //58a
    private ActnoBicAdrTagXXX requestedConfirmationParty;

    @Status("O")
    @TagName("53a")
    @FieldDescription("Reimbursing Bank")
    @TagRegex("A or D")
    //53a
    private ActnoBicAdrTagXXX reimbursingBank;

    @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")
    @FieldDescription("Advise Through Bank")
    @TagRegex("A, B, or D")
    //57a
    private ActnoBicAdrTagXXX adviseThroughBank;

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

    public String getSequenceofTotal() {
        return sequenceofTotal;
    }

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

    public String getFormofDocumentaryCredit() {
        return formofDocumentaryCredit;
    }

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

    public String getSendersReference() {
        return sendersReference;
    }

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

    public String getDocumentaryCreditNumber() {
        return documentaryCreditNumber;
    }

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

    public String getReferencetoPreAdvice() {
        return referencetoPreAdvice;
    }

    public void setReferencetoPreAdvice(String referencetoPreAdvice) {
        this.referencetoPreAdvice = referencetoPreAdvice;
    }

    public String getDateofIssue() {
        return dateofIssue;
    }

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

    public String getApplicableRules() {
        return applicableRules;
    }

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

    public String getDateandPlaceofExpiry() {
        return dateandPlaceofExpiry;
    }

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

    public ActnoBicAdrTagXXX getIssuingBank() {
        return issuingBank;
    }

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

    public String getNonBankIssuer() {
        return nonBankIssuer;
    }

    public void setNonBankIssuer(String nonBankIssuer) {
        this.nonBankIssuer = nonBankIssuer;
    }

    public ActnoBicAdrTagXXX getApplicantBank() {
        return applicantBank;
    }

    public void setApplicantBank(ActnoBicAdrTagXXX applicantBank) {
        this.applicantBank = applicantBank;
    }

    public String getApplicant() {
        return applicant;
    }

    public void setApplicant(String applicant) {
        this.applicant = applicant;
    }

    public ActnoBicAdrTagXXX getBeneficiary() {
        return beneficiary;
    }

    public void setBeneficiary(ActnoBicAdrTagXXX beneficiary) {
        this.beneficiary = beneficiary;
    }

    public DcDateCurAmtTagXXX getCurrencyCodeAmount() {
        return currencyCodeAmount;
    }

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

    public ActnoBicAdrTagXXX getAvailableWithBy() {
        return availableWithBy;
    }

    public void setAvailableWithBy(ActnoBicAdrTagXXX availableWithBy) {
        this.availableWithBy = availableWithBy;
    }

    public String getDraftsat() {
        return draftsat;
    }

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

    public ActnoBicAdrTagXXX getDrawee() {
        return drawee;
    }

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

    public ActnoBicAdrTagXXX getRequestedConfirmationParty() {
        return requestedConfirmationParty;
    }

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

    public ActnoBicAdrTagXXX getReimbursingBank() {
        return reimbursingBank;
    }

    public void setReimbursingBank(ActnoBicAdrTagXXX reimbursingBank) {
        this.reimbursingBank = reimbursingBank;
    }

    public ActnoBicAdrTagXXX getAdviseThroughBank() {
        return adviseThroughBank;
    }

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

    public String getPercentageCreditAmountTolerance() {
        return percentageCreditAmountTolerance;
    }

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

    public String getAdditionalAmountsCovered() {
        return additionalAmountsCovered;
    }

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



    public String getMixedPaymentDetails() {
        return mixedPaymentDetails;
    }

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

    public String getNegotiationDeferredPaymentDetails() {
        return negotiationDeferredPaymentDetails;
    }

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

    public String getPartialShipments() {
        return partialShipments;
    }

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

    public String getTranshipment() {
        return transhipment;
    }

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

    public String getPlaceofTakinginChargeDispatchfromPlaceofReceipt() {
        return placeofTakinginChargeDispatchfromPlaceofReceipt;
    }

    public void setPlaceofTakinginChargeDispatchfromPlaceofReceipt(String placeofTakinginChargeDispatchfromPlaceofReceipt) {
        this.placeofTakinginChargeDispatchfromPlaceofReceipt = placeofTakinginChargeDispatchfromPlaceofReceipt;
    }

    public String getPortofLoadingAirportofDeparture() {
        return portofLoadingAirportofDeparture;
    }

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

    public String getPortofDischargeAirportofDestination() {
        return portofDischargeAirportofDestination;
    }

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

    public String getPlaceofFinalDestinationForTransportationtoPlaceofDelivery() {
        return placeofFinalDestinationForTransportationtoPlaceofDelivery;
    }

    public void setPlaceofFinalDestinationForTransportationtoPlaceofDelivery(String placeofFinalDestinationForTransportationtoPlaceofDelivery) {
        this.placeofFinalDestinationForTransportationtoPlaceofDelivery = placeofFinalDestinationForTransportationtoPlaceofDelivery;
    }

    public String getLatestDateofShipment() {
        return latestDateofShipment;
    }

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

    public String getShipmentPeriod() {
        return shipmentPeriod;
    }

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

    public String getDescriptionofGoodsandorServices() {
        return descriptionofGoodsandorServices;
    }

    public void setDescriptionofGoodsandorServices(String descriptionofGoodsandorServices) {
        this.descriptionofGoodsandorServices = descriptionofGoodsandorServices;
    }

    public String getDocumentsRequired() {
        return documentsRequired;
    }

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

    public String getAdditionalConditions() {
        return additionalConditions;
    }

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

    public String getSpecialPaymentConditionsforBeneficiary() {
        return specialPaymentConditionsforBeneficiary;
    }

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

    public String getSpecialPaymentConditionsforBankOnly() {
        return specialPaymentConditionsforBankOnly;
    }

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

    public String getCharges() {
        return charges;
    }

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

    public String getPeriodforPresentationinDays() {
        return periodforPresentationinDays;
    }

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

    public String getConfirmationInstructions() {
        return confirmationInstructions;
    }

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



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



    public String getSendertoReceiverInformation() {
        return sendertoReceiverInformation;
    }

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

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

    /**
     * 需要编写组装报文逻辑，调用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 Tag23Creator(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 Tag51aCreator(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 Tag53aCreator(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;
    }
}
