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.tag760.*;
import com.brilliance.isc.swift.objmtconvert.result.MtResult;
import lombok.Getter;
import lombok.Setter;

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

@Getter
@Setter
public class MT760Creator extends AbsMTCreator {

    //Sequence A
    @Status("M")
    @TagName("15A")
    @FieldDescription("New Sequence")
    @TagRegex("Empty field")
    //15A
    private String newSequenceOfA;
    @Status("M")
    @TagName("27")
    @FieldDescription("Sequence of Total")
    @TagRegex("1!n/1!n")
    //27 of A
    private String sequenceofTotalOfA;
    @Status("M")
    @TagName("22A")
    @FieldDescription("Purpose of Message")
    @TagRegex("4!c")
    //22A of A
    private String purposeofMessageOfA;
    @Status("O")
    @TagName("72Z")
    @FieldDescription("Sender to Receiver Information")
    @TagRegex("6*35z")
    //72Z of A
    private ActnoBicAdrTagXXX sendertoReceiverInformationOfA;
    @Status("O")
    @TagName("23X")
    @FieldDescription("File Identification")
    @TagRegex("4!c/65x")
    //23X of A
    private String fileIdentificationOfA;

    //Sequence B
    @Status("M")
    @TagName("15B")
    @FieldDescription("New Sequence")
    @TagRegex("Empty field")
    //15B
    private String newSequenceOfB;
    @Status("M")
    @TagName("20")
    @FieldDescription("Undertaking Number")
    @TagRegex("16x")
    //20 of B
    private String undertakingNumberOfB;
    @Status("M")
    @TagName("30")
    @FieldDescription("Date of Issue")
    @TagRegex("6!n")
    //30 of B
    private String dateofIssueOfB;
    @Status("M")
    @TagName("22D")
    @FieldDescription("Form of Undertaking")
    @TagRegex("4!c")
    //22D of B
    private String formofUndertakingOfB;
    @Status("M")
    @TagName("40C")
    @FieldDescription("Applicable Rules")
    @TagRegex("4!a[/35x]")
    //40C of B
    private String applicableRulesOfB;
    @Status("M")
    @TagName("23B")
    @FieldDescription("Expiry Type")
    @TagRegex("4!c")
    //23B of B
    private String expiryTypeOfB;
    @Status("O")
    @TagName("31E")
    @FieldDescription("Date of Expiry")
    @TagRegex("6!n")
    //31E of B
    private String dateofExpiryOfB;
    @Status("O")
    @TagName("35G")
    @FieldDescription("Expiry Condition/Event")
    @TagRegex("12*65x")
    //35G of B
    private String expiryConditionEventOfB;
    @Status("O")
    @TagName("50")
    @FieldDescription("Applicant")
    @TagRegex("4*35x")
    //50 of B
    private String applicantOfB;
    @Status("O")
    @TagName("51")
    @FieldDescription("Obligor/Instructing Party")
    @TagRegex("4*35x")
    //51 of B
    private String obligorInstructingPartyOfB;
    @Status("M")
    @TagName({"52A","52D"})
    @FieldDescription("Issuer")
    @TagRegex({"[/1!a][/34x]<crlf>4!a2!a2!c[3!c]","[/1!a][/34x]<crlf>4*35x"})
    //52a of B
    private ActnoBicAdrTagXXX issuerOfB;
    @Status("M")
    @TagName({"59","59A"})
    @FieldDescription("Beneficiary")
    @TagRegex({"[/34x]<crlf>4*35x","[/34x]<crlf>4!a2!a2!c[3!c]"})
    //59a of B
    private ActnoBicAdrTagXXX beneficiaryOfB;
    @Status("O")
    @TagName({"56A","56D"})
    @FieldDescription("Advising Bank")
    @TagRegex({"[/1!a][/34x]<crlf>4!a2!a2!c[3!c]","[/1!a][/34x]<crlf>4*35x"})
    //56a of B
    private ActnoBicAdrTagXXX advisingBankOfB;
    @Status("O")
    @TagName("23")
    @FieldDescription("Advising Bank Reference")
    @TagRegex("16x")
    //23 of B
    private String advisingBankReferenceOfB;
    @Status("O")
    @TagName({"57A","57D"})
    @FieldDescription("'Advise Through' Bank")
    @TagRegex({"[/1!a][/34x]<crlf>4!a2!a2!c[3!c]","[/1!a][/34x]<crlf>4*35x"})
    //57a of B
    private ActnoBicAdrTagXXX adviseThroughBankOfB;
    @Status("M")
    @TagName("32B")
    @FieldDescription("Undertaking Amount")
    @TagRegex("3!a15d")
    //32B of B
    private DcDateCurAmtTagXXX undertakingAmountOfB;
    @Status("O")
    @TagName("39F")
    @FieldDescription("Supplementary Information About Amount")
    @TagRegex("12*65z")
    //39F of B
    private String supplementaryInformationAboutAmountOfB;
    @Status("O")
    @TagName({"41F","41G"})
    @FieldDescription("Available With...")
    @TagRegex({"4!a2!a2!c[3!c]","4*35x"})
    //41a of B
    private ActnoBicAdrTagXXX availableWithOfB;
    @Status("O")
    @TagName("71D")
    @FieldDescription("Charges")
    @TagRegex("6*35z")
    //71D of B
    private ActnoBicAdrTagXXX chargesOfB;
    @Status("O")
    @TagName("45C")
    @FieldDescription("Document and Presentation Instructions")
    @TagRegex("100*65z")
    //45C of B
    private String documentandPresentationInstructionsOfB;
    @Status("M")
    @TagName("77U")
    @FieldDescription("Undertaking Terms and Conditions")
    @TagRegex("1200*65z")
    //77U of B
    private String undertakingTermsandConditionsOfB;
    @Status("O")
    @TagName("49")
    @FieldDescription("Confirmation Instructions")
    @TagRegex("7!x")
    //49 of B
    private String confirmationInstructionsOfB;
    @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 of B
    private ActnoBicAdrTagXXX requestedConfirmationPartyOfB;
    @Status("O")
    @TagName("44J")
    @FieldDescription("Governing Law/Jurisdiction")
    @TagRegex("2!a[/35x]<crlf>[/65x]")
    //44J of B
    private String governingLawJurisdictionOfB;
    @Status("O")
    @TagName("23F")
    @FieldDescription("Automatic Extension Period")
    @TagRegex("4!a[/35x]")
    //23F of B
    private String automaticExtensionPeriodOfB;
    @Status("O")
    @TagName("78")
    @FieldDescription("Automatic Extension Non-Extension Notification")
    @TagRegex("12*65x")
    //78 of B
    private String automaticExtensionNonExtensionNotificationOfB;
    @Status("O")
    @TagName("26E")
    @FieldDescription("Automatic Extension Notification Period")
    @TagRegex("3n")
    //26E of B
    private String automaticExtensionNotificationPeriodOfB;
    @Status("O")
    @TagName("31S")
    @FieldDescription("Automatic Extension Final Expiry Date")
    @TagRegex("6!n")
    //31S of B
    private String automaticExtensionFinalExpiryDateOfB;
    @Status("O")
    @TagName("48B")
    @FieldDescription("Demand Indicator")
    @TagRegex("4!c")
    //48B of B
    private String demandIndicatorOfB;
    @Status("O")
    @TagName("48D")
    @FieldDescription("Transfer Indicator")
    @TagRegex("4!c")
    //48D of B
    private String transferIndicatorOfB;
    @Status("O")
    @TagName("39E")
    @FieldDescription("Transfer Conditions")
    @TagRegex("12*65z")
    //39E of B
    private String transferConditionsOfB;
    @Status("O")
    @TagName("45L")
    @FieldDescription("Underlying Transaction Details")
    @TagRegex("50*65z")
    //45L of B
    private String underlyingTransactionDetailsOfB;
    @Status("O")
    @TagName("24E")
    @FieldDescription("Delivery of Original Undertaking")
    @TagRegex("4!c[/35x]")
    //24E of B
    private String deliveryofOriginalUndertakingOfB;
    @Status("O")
    @TagName("24G")
    @FieldDescription("Delivery To/Collection By")
    @TagRegex("4!c<crlf>[12*65z]")
    //24G of B
    private ActnoBicAdrTagXXX deliveryToCollectionByOfB;

    //Sequence C
    @Status("M")
    @TagName("15C")
    @FieldDescription("New Sequence")
    @TagRegex("Empty field")
    //15C
    private String newSequenceOfC;
    @Status("O")
    @TagName("31C")
    @FieldDescription("Requested Date of Issue")
    @TagRegex("6!n")
    //31C of C
    private String requestedDateofIssueOfC;
    @Status("M")
    @TagName("22D")
    @FieldDescription("Form of Undertaking")
    @TagRegex("4!c")
    //22D of C
    private String formofUndertakingOfC;
    @Status("M")
    @TagName("40C")
    @FieldDescription("Applicable Rules")
    @TagRegex("4!a[/35x]")
    //40C of C
    private String applicableRulesOfC;
    @Status("O")
    @TagName("22K")
    @FieldDescription("Type of Undertaking")
    @TagRegex("4!c[/35x]")
    //22K of C
    private String typeofUndertakingOfC;
    @Status("M")
    @TagName("23B")
    @FieldDescription("Expiry Type")
    @TagRegex("4!c")
    //23B of C
    private String expiryTypeOfC;
    @Status("O")
    @TagName("31E")
    @FieldDescription("Date of Expiry")
    @TagRegex("6!n")
    //31E of C
    private String dateofExpiryOfC;
    @Status("O")
    @TagName("35G")
    @FieldDescription("Expiry Condition/Event")
    @TagRegex("12*65x")
    //35G of C
    private String expiryConditionEventOfC;
    @Status("M")
    @TagName("50")
    @FieldDescription("Applicant")
    @TagRegex("4*35x")
    //50 of C
    private String applicantOfC;
    @Status("O")
    @TagName("51")
    @FieldDescription("Obligor/Instructing Party")
    @TagRegex("4*35x")
    //51 of C
    private String obligorInstructingPartyOfC;
    @Status("O")
    @TagName({"52A","52D"})
    @FieldDescription("Issuer")
    @TagRegex({"[/1!a][/34x]<crlf>4!a2!a2!c[3!c]","[/1!a][/34x]<crlf>4*35x"})
    //52a of C
    private ActnoBicAdrTagXXX issuerOfC;
    @Status("M")
    @TagName("59")
    @FieldDescription("Beneficiary")
    @TagRegex("[/34x]<crlf>4*35x")
    //59 of C
    private ActnoBicAdrTagXXX beneficiaryOfC;
    @Status("M")
    @TagName("32B")
    @FieldDescription("Undertaking Amount")
    @TagRegex("3!a15d")
    //32B of C
    private DcDateCurAmtTagXXX undertakingAmountOfC;
    @Status("O")
    @TagName("39F")
    @FieldDescription("Supplementary Information About Amount")
    @TagRegex("12*65z")
    //39F of C
    private String supplementaryInformationAboutAmountOfC;

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

    @Status("O")
    @TagName({"41F","41G"})
    @FieldDescription("Available With...")
    @TagRegex({"4!a2!a2!c[3!c]","4*35x"})
    //41a of C
    private ActnoBicAdrTagXXX availableWithOfC;
    @Status("O")
    @TagName("71D")
    @FieldDescription("Charges")
    @TagRegex("6*35z")
    //71D of C
    private ActnoBicAdrTagXXX chargesOfC;
    @Status("O")
    @TagName("45C")
    @FieldDescription("Document and Presentation Instructions")
    @TagRegex("100*65z")
    //45C of C
    private String documentandPresentationInstructionsOfC;
    @Status("O")
    @TagName("77L")
    @FieldDescription("Requested Local Undertaking Terms and Conditions")
    @TagRegex("1200*65z")
    //77L of C
    private String requestedLocalUndertakingTermsandConditionsOfC;
    @Status("O")
    @TagName("22Y")
    @FieldDescription("Standard Wording Required")
    @TagRegex("4!c")
    //22Y of C
    private String standardWordingRequiredOfC;
    @Status("O")
    @TagName("40D")
    @FieldDescription("Standard Wording Requested Language")
    @TagRegex("2!a")
    //40D of C
    private String standardWordingRequestedLanguageOfC;
    @Status("O")
    @TagName("44J")
    @FieldDescription("Governing Law/Jurisdiction")
    @TagRegex("2!a[/35x]<crlf>[/65x]")
    //44J of C
    private String governingLawJurisdictionOfC;
    @Status("O")
    @TagName("23F")
    @FieldDescription("Automatic Extension Period")
    @TagRegex("4!a[/35x]")
    //23F of C
    private String automaticExtensionPeriodOfC;
    @Status("O")
    @TagName("78")
    @FieldDescription("Automatic Extension Non-Extension Notification")
    @TagRegex("12*65x")
    //78 of C
    private String automaticExtensionNonExtensionNotificationOfC;
    @Status("O")
    @TagName("26E")
    @FieldDescription("Automatic Extension Notification Period")
    @TagRegex("3n")
    //26E of C
    private String automaticExtensionNotificationPeriodOfC;
    @Status("O")
    @TagName("31S")
    @FieldDescription("Automatic Extension Final Expiry Date")
    @TagRegex("6!n")
    //31S of C
    private String automaticExtensionFinalExpiryDateOfC;
    @Status("O")
    @TagName("48B")
    @FieldDescription("Demand Indicator")
    @TagRegex("4!c")
    //48B of C
    private String demandIndicatorOfC;
    @Status("O")
    @TagName("48D")
    @FieldDescription("Transfer Indicator")
    @TagRegex("4!c")
    //48D of C
    private String transferIndicatorOfC;
    @Status("O")
    @TagName("39E")
    @FieldDescription("Transfer Conditions")
    @TagRegex("12*65z")
    //39E of C
    private String transferConditionsOfC;
    @Status("M")
    @TagName("45L")
    @FieldDescription("Underlying Transaction Details")
    @TagRegex("50*65z")
    //45L of C
    private String underlyingTransactionDetailsOfC;
    @Status("O")
    @TagName("24E")
    @FieldDescription("Delivery of Local Undertaking")
    @TagRegex("4!c[/35x]")
    //24E of C
    private String deliveryofLocalUndertakingOfC;
    @Status("O")
    @TagName("24G")
    @FieldDescription("Delivery To/Collection By")
    @TagRegex("4!c<crlf>[12*65z]")
    //24G of C
    private ActnoBicAdrTagXXX deliveryToCollectionByOfC;

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

    public MT760Creator() {
        super("760");
    }

    /**
     * 需要编写组装报文逻辑，调用set方法即可
     *
     * @return
     */
    public void pack() {
        // MtResult mtResult = new MtResult();
        List<AbsTagCreate> tagCreateList = new ArrayList<>();
        try {
            //Sequence A
            tagCreateList.add(new TagA15ACreator(this));
            tagCreateList.add(new TagA27Creator(this));
            tagCreateList.add(new TagA22ACreator(this));
            tagCreateList.add(new TagA72ZCreator(this));
            tagCreateList.add(new TagA23XCreator(this));
            //Sequence B
            tagCreateList.add(new TagB15BCreator(this));
            tagCreateList.add(new TagB20Creator(this));
            tagCreateList.add(new TagB30Creator(this));
            tagCreateList.add(new TagB22DCreator(this));
            tagCreateList.add(new TagB40CCreator(this));
            tagCreateList.add(new TagB23BCreator(this));
            tagCreateList.add(new TagB31ECreator(this));
            tagCreateList.add(new TagB35GCreator(this));
            tagCreateList.add(new TagB50Creator(this));
            tagCreateList.add(new TagB51Creator(this));
            tagCreateList.add(new TagB52aCreator(this));
            tagCreateList.add(new TagB59aCreator(this));
            tagCreateList.add(new TagB56aCreator(this));
            tagCreateList.add(new TagB23Creator(this));
            tagCreateList.add(new TagB57aCreator(this));
            tagCreateList.add(new TagB32BCreator(this));
            tagCreateList.add(new TagB39FCreator(this));
            tagCreateList.add(new TagB41aCreator(this));
            tagCreateList.add(new TagB71DCreator(this));
            tagCreateList.add(new TagB45CCreator(this));
            tagCreateList.add(new TagB77UCreator(this));
            tagCreateList.add(new TagB49Creator(this));
            tagCreateList.add(new TagB58aCreator(this));
            tagCreateList.add(new TagB44JCreator(this));
            tagCreateList.add(new TagB23FCreator(this));
            tagCreateList.add(new TagB78Creator(this));
            tagCreateList.add(new TagB26ECreator(this));
            tagCreateList.add(new TagB31SCreator(this));
            tagCreateList.add(new TagB48BCreator(this));
            tagCreateList.add(new TagB48DCreator(this));
            tagCreateList.add(new TagB39ECreator(this));
            tagCreateList.add(new TagB45LCreator(this));
            tagCreateList.add(new TagB24ECreator(this));
            tagCreateList.add(new TagB24GCreator(this));
            //Sequence C
            tagCreateList.add(new TagC15CCreator(this));
            tagCreateList.add(new TagC31CCreator(this));
            tagCreateList.add(new TagC22DCreator(this));
            tagCreateList.add(new TagC40CCreator(this));
            tagCreateList.add(new TagC22KCreator(this));
            tagCreateList.add(new TagC23BCreator(this));
            tagCreateList.add(new TagC31ECreator(this));
            tagCreateList.add(new TagC35GCreator(this));
            tagCreateList.add(new TagC50Creator(this));
            tagCreateList.add(new TagC51Creator(this));
            tagCreateList.add(new TagC52aCreator(this));
            tagCreateList.add(new TagC59Creator(this));
            tagCreateList.add(new TagC32BCreator(this));
            tagCreateList.add(new TagC39FCreator(this));
            tagCreateList.add(new TagC57aCreator(this));
            tagCreateList.add(new TagC41aCreator(this));
            tagCreateList.add(new TagC71DCreator(this));
            tagCreateList.add(new TagC45CCreator(this));
            tagCreateList.add(new TagC77LCreator(this));
            tagCreateList.add(new TagC22YCreator(this));
            tagCreateList.add(new TagC40DCreator(this));
            tagCreateList.add(new TagC44JCreator(this));
            tagCreateList.add(new TagC23FCreator(this));
            tagCreateList.add(new TagC78Creator(this));
            tagCreateList.add(new TagC26ECreator(this));
            tagCreateList.add(new TagC31SCreator(this));
            tagCreateList.add(new TagC48BCreator(this));
            tagCreateList.add(new TagC48DCreator(this));
            tagCreateList.add(new TagC39ECreator(this));
            tagCreateList.add(new TagC45LCreator(this));
            tagCreateList.add(new TagC24ECreator(this));
            tagCreateList.add(new TagC24GCreator(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;
    }

}

