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


import java.util.ArrayList;
import java.util.List;

/**
 * @author gechengyang
 * @date 2023/2/17
 */
public class MT700Creator extends AbsMTCreator {
    @Status("M")
    @TagName("27")
    @FieldDescription("Sequence of Total")
    @TagRegex("1!n/1!n")
    //27
    public String sequenceofTotal;

    @Status("M")
    @TagName("40A")
    @FieldDescription("Form of Documentary Credit")
    @TagRegex("24x")
    //40A
    public String formofDocumentaryCredit;

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

    @Status("O")
    @TagName("23")
    @FieldDescription("Reference to Pre-Advice")
    @TagRegex("16x")
    //23
    public String referencetoPreAdvice;

    @Status("M")
    @TagName("31C")
    @FieldDescription("Date of Issue")
    @TagRegex("6!n")
    //31C
    public String dateOfIssue;

    @Status("M")
    @TagName("40E")
    @FieldDescription("Applicable Rules")
    @TagRegex("30x[/35x]")
    //40E
    public String applicableRules;

    @Status("M")
    @TagName("31D")
    @FieldDescription("Date and Place of Expiry")
    @TagRegex("6!n29x")
    //31D
    public String dateAndPlaceOfExpiry;

    @Status("O")
    @TagName({"51A","51D"})
    @FieldDescription("Applicant Bank")
    @TagRegex({"[/1!a][/34x]<crlf>4!a2!a2!c[3!c]","[/1!a][/34x]<crlf>4*35x"})
    //51a
    public ActnoBicAdrTagXXX applicantBank;

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

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

    @Status("M")
    @TagName("32B")
    @FieldDescription("Currency Code, Amount")
    @TagRegex("3!a15d")
    //32B
    public DcDateCurAmtTagXXX currencyCodeAmount;

    @Status("O")
    @TagName("39A")
    @FieldDescription("Percentage Credit Amount Tolerance")
    @TagRegex("2n/2n")
    //39A
    public String pcentgeCrdtAmntTolrance;

    @Status("O")
    @TagName("39C")
    @FieldDescription("Additional Amounts Covered")
    @TagRegex("4*35x")
    //39C
    public 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
    public ActnoBicAdrTagXXX availableWithBy;

    @Status("O")
    @TagName("42C")
    @FieldDescription("Drafts at ...")
    @TagRegex("3*35x")
    //42C
    public 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
    public ActnoBicAdrTagXXX drawee;

    @Status("O")
    @TagName("42M")
    @FieldDescription("Mixed Payment Details")
    @TagRegex("4*35x")
    //42M
    public String mixedPaymentDetails;

    @Status("O")
    @TagName("42P")
    @FieldDescription("Negotiation/Deferred Payment Details")
    @TagRegex("4*35x")
    //42P
    public String negtionDfredPaymentDetail;

    @Status("O")
    @TagName("43P")
    @FieldDescription("Partial Shipments")
    @TagRegex("11x")
    //43P
    public String partialShipments;

    @Status("O")
    @TagName("43T")
    @FieldDescription("Transhipment")
    @TagRegex("11x")
    //43T
    public String transhipment;

    @Status("O")
    @TagName("44A")
    @FieldDescription("Place of Taking in Charge/Dispatch from .../Place of Receipt")
    @TagRegex("65x")
    //44A
    public String placeOfTakInChargTranDeli;

    @Status("O")
    @TagName("44E")
    @FieldDescription("Port of Loading/Airport of Departure")
    @TagRegex("65x")
    //44E
    public String portOfLoading;

    @Status("O")
    @TagName("44F")
    @FieldDescription("Port of Discharge/Airport of Destination")
    @TagRegex("65x")
    //44F
    public String portOfDischarge;

    @Status("O")
    @TagName("44B")
    @FieldDescription("Place of Final Destination/For Transportation to .../Place of Delivery")
    @TagRegex("65x")
    //44B
    public String placeOfFinalDestination;

    @Status("O")
    @TagName("44C")
    @FieldDescription("Latest Date of Shipment")
    @TagRegex("6!n")
    //44C
    public String latestDateOfShipment;

    @Status("O")
    @TagName("44D")
    @FieldDescription("Shipment Period")
    @TagRegex("6*65x")
    //44D
    public String shipmentPeriod;

    @Status("O")
    @TagName("45A")
    @FieldDescription("Description of Goods and/or Services")
    @TagRegex("100*65z")
    //45A
    public String descOfGoodsAndServ;

    @Status("O")
    @TagName("46A")
    @FieldDescription("Documents Required")
    @TagRegex("100*65z")
    //46A
    public String documentsRequired;

    @Status("O")
    @TagName("47A")
    @FieldDescription("Additional Conditions")
    @TagRegex("100*65z")
    //47A
    public String additionalConditions;

    @Status("O")
    @TagName("49G")
    @FieldDescription("Special Payment Conditions for Beneficiary")
    @TagRegex("100*65z")
    //49G
    public String specPaymentCondForBenefi;

    @Status("O")
    @TagName("49H")
    @FieldDescription("Special Payment Conditions for Bank Only")
    @TagRegex("100*65z")
    //49H
    public String specPaymCndiForRecvBank;

    @Status("O")
    @TagName("71D")
    @FieldDescription("Charges")
    @TagRegex("6*35z")
    //71D
    public String charges;

    @Status("O")
    @TagName("48")
    @FieldDescription("Period for Presentation in Days")
    @TagRegex("3n[/35x]")
    //48
    public String periodForPresentaInDays;

    @Status("M")
    @TagName("49")
    @FieldDescription("Confirmation Instructions")
    @TagRegex("7!x")
    //49
    public 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
    public ActnoBicAdrTagXXX requestedConfirmationParty;

    @Status("O")
    @TagName({"53A","53D"})
    @FieldDescription("Reimbursing Bank")
    @TagRegex({"[/1!a][/34x]<crlf>4!a2!a2!c[3!c]","[/1!a][/34x]<crlf>4*35x"})
    //53a
    public ActnoBicAdrTagXXX reimbursingBank;

    @Status("O")
    @TagName("78")
    @FieldDescription("Instructions to the Paying/Accepting/Negotiating Bank")
    @TagRegex("12*65x")
    //78
    public String instrToThePayAccNegBank;

    @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>4*35x"})
    //57a
    public ActnoBicAdrTagXXX adviseThroughBank;

    @Status("O")
    @TagName("72Z")
    @FieldDescription("Sender to Receiver Information")
    @TagRegex("6*35z")
    //72Z
    public ActnoBicAdrTagXXX 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 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 String getApplicant() {
        return applicant;
    }

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


    public String getPcentgeCrdtAmntTolrance() {
        return pcentgeCrdtAmntTolrance;
    }

    public void setPcentgeCrdtAmntTolrance(String pcentgeCrdtAmntTolrance) {
        this.pcentgeCrdtAmntTolrance = pcentgeCrdtAmntTolrance;
    }

    public String getAdditionalAmountsCovered() {
        return additionalAmountsCovered;
    }

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



    public String getDraftsAt() {
        return draftsAt;
    }

    public void setDraftsAt(String draftsAt) {
        this.draftsAt = draftsAt;
    }



    public String getMixedPaymentDetails() {
        return mixedPaymentDetails;
    }

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

    public String getNegtionDfredPaymentDetail() {
        return negtionDfredPaymentDetail;
    }

    public void setNegtionDfredPaymentDetail(String negtionDfredPaymentDetail) {
        this.negtionDfredPaymentDetail = negtionDfredPaymentDetail;
    }

    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 getPlaceOfTakInChargTranDeli() {
        return placeOfTakInChargTranDeli;
    }

    public void setPlaceOfTakInChargTranDeli(String placeOfTakInChargTranDeli) {
        this.placeOfTakInChargTranDeli = placeOfTakInChargTranDeli;
    }

    public String getPortOfLoading() {
        return portOfLoading;
    }

    public void setPortOfLoading(String portOfLoading) {
        this.portOfLoading = portOfLoading;
    }

    public String getPortOfDischarge() {
        return portOfDischarge;
    }

    public void setPortOfDischarge(String portOfDischarge) {
        this.portOfDischarge = portOfDischarge;
    }

    public String getPlaceOfFinalDestination() {
        return placeOfFinalDestination;
    }

    public void setPlaceOfFinalDestination(String placeOfFinalDestination) {
        this.placeOfFinalDestination = placeOfFinalDestination;
    }

    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 getDescOfGoodsAndServ() {
        return descOfGoodsAndServ;
    }

    public void setDescOfGoodsAndServ(String descOfGoodsAndServ) {
        this.descOfGoodsAndServ = descOfGoodsAndServ;
    }

    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 getSpecPaymentCondForBenefi() {
        return specPaymentCondForBenefi;
    }

    public void setSpecPaymentCondForBenefi(String specPaymentCondForBenefi) {
        this.specPaymentCondForBenefi = specPaymentCondForBenefi;
    }

    public String getSpecPaymCndiForRecvBank() {
        return specPaymCndiForRecvBank;
    }

    public void setSpecPaymCndiForRecvBank(String specPaymCndiForRecvBank) {
        this.specPaymCndiForRecvBank = specPaymCndiForRecvBank;
    }

    public String getCharges() {
        return charges;
    }

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

    public String getPeriodForPresentaInDays() {
        return periodForPresentaInDays;
    }

    public void setPeriodForPresentaInDays(String periodForPresentaInDays) {
        this.periodForPresentaInDays = periodForPresentaInDays;
    }

    public String getConfirmationInstructions() {
        return confirmationInstructions;
    }

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

    public String getInstrToThePayAccNegBank() {
        return instrToThePayAccNegBank;
    }

    public void setInstrToThePayAccNegBank(String instrToThePayAccNegBank) {
        this.instrToThePayAccNegBank = instrToThePayAccNegBank;
    }

    public ActnoBicAdrTagXXX getApplicantBank() {
        return applicantBank;
    }

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

    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 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 ActnoBicAdrTagXXX getSenderToReceiverInformation() {
        return senderToReceiverInformation;
    }

    public void setSenderToReceiverInformation(ActnoBicAdrTagXXX senderToReceiverInformation) {
        this.senderToReceiverInformation = senderToReceiverInformation;
    }

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

    public MT700Creator() {
        super("700");
    }

    /**
     * 需要编写组装报文逻辑，调用set方法即可
     *
     * @return
     */
    public void pack() {
     //   MtResult mtResult = new MtResult();
        List<AbsTagCreate> tagCreateList = new ArrayList<>();
        try {
            tagCreateList.add(new Tag27Creator(this));
            tagCreateList.add(new Tag40ACreator(this));
            tagCreateList.add(new Tag20Creator(this));
            tagCreateList.add(new Tag23Creator(this));
            tagCreateList.add(new Tag31CCreator(this));
            tagCreateList.add(new Tag40ECreator(this));
            tagCreateList.add(new Tag31DCreator(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 Tag57aCreator(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;
    }
}
