package com.brilliance.isc.vo.model;


import com.brilliance.mda.runtime.mda.IStream;
import com.brilliance.mda.runtime.mda.impl.StreamImpl;
import com.brilliance.mda.runtime.mda.util.Decimals;
import com.brilliance.isc.bo.*;
import com.brilliance.isc.common.vo.AbstractCommonVo;
import com.brilliance.isc.common.vo.PtsptaVo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import static com.brilliance.mda.runtime.mda.Constants.NULLSTR;


/**
 * Contract Group Guarantee
 */
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class Nidgrp extends AbstractCommonVo {

    private String pansta;
    //guarantee text
    private String nidtxt;
    //original guarantee text without variables
    private String oldnidtxt;
    //original guarantee text with variables
    private String oldgtxnidtxt;
    //Label set if nore than one applicant
    private String morapllab;
    //guarantee text
    private String nidtxt2;
    //original guarantee text without variables
    private String oldnidtxt2;
    //original guarantee text with variables
    private String oldgtxnidtxt2;
    //return copy of undertaking
    private String rtncop;
    //Flag for Difference shown for languange
    private String difstrflg;
    //Modify Guarantee Text
    private String nidtxtmodflg;
    //Label unlimited Validity
    private String explab;
    //Label unlimited lLability
    private String lialab;
    //New content for vs. System
    private String newnidsys;
    //New content for vs. System
    private String newnidsys2;
    //Old content for vs. System
    private String oldnidsys;
    //Old content for vs. System
    private String oldnidsys2;
    //New content for vs. History
    private String newnidhis;
    //New content for vs. History
    private String newnidhis2;
    //Old content for vs. History
    private String oldnidhis;
    //Old content for vs. History
    private String oldnidhis2;
    //Diff vs. History
    private String difstrhis;
    //Diff vs. History
    private String difstrhis2;
    //Diff vs. System
    private String difstrsys;
    //Diff vs. System
    private String difstrsys2;
    //Label, that is set, if there are multiple applicants
    private String aplmullab;
    //Label for Field Lability
    private String liafldlab;
    //Label for Field Validity
    private String expfldlab;

    private String shwnidtxtp;
    //Label for Additional Info
    private String labaddinf;
    //Label for Contract Date
    private String laborcdat;
    //Label for Original Reference
    private String laborcref;
    //Label for Contract Date
    private String labtrmdat;
    //guarantee text

    private String shwnidtxtp2;
    //Label for Additional Info
    private String labaddinf1;
    //Label for Contract Date
    private String laborcdat1;
    //Label for Original Reference
    private String laborcref1;
    //Label for Contract Date
    private String labtrmdat1;
    //Advice Date

    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date advdat;
    //Suppress Applicant in 760 Seqence C Flag
    private String apcsupflg;
    //Suppress Applicant in 760 Seqence B Flag
    private String aplsupflg;
    //Object of Contract
    private String covgodsrv;
    //Modify Object of Contract Sequence C
    private String covgodsrvcmodflg;
    //Diff vs. System - Local Undertaking Seq. C

    private String difstrsysc;
    //Diff vs. History - Local Undertaking Seq. C

    private String difstrhisc;
    //Object of Contract Sequence C
    private String covgodsrvc;
    //Modify Object of Contract
    private String covgodsrvmodflg;
    //Liability Condition/Event - Counter Undertaking
    private String liatxtc;
    //Modify Expiry Condition/Event
    private String exptxtmodflg;
    //guarantee text - Local Undertaking Seq. C

    private String nidtxtc;
    //Modify Guarantee Text - Local Undertaking Seq. C
    private String nidtxtmodflgc;
    //Modify Guarantee Text
    private String nidtxtmodflg2;
    //Expiry Condition/Event
    private String exptxt;
    //New content for vs. History

    private String newcovgodsrvchis;
    //New content for vs. History

    private String newcovgodsrvhis;
    //New content for vs. History

    private String newexptxthis;
    //New content for vs. System

    private String newcovgodsrvcsys;
    //New content for vs. System

    private String newexptxtsys;
    //Incoming Corporate Message Flag
    private String inccormsgflg;
    //New content for vs. System

    private String newcovgodsrvsys;
    //New content for vs. History

    private String newliatxtchis;
    //Modify Liability Condition/Event - Counter Undertaking
    private String liatxtcmodflg;
    //New content for vs. System

    private String newliatxtcsys;
    //New content for vs. System - Local Undertaking Seq. C

    private String newnidsysc;
    //New content for vs. History

    private String newpreperchis;
    //New content for vs. History - Local Undertaking Seq. C

    private String newnidhisc;
    //New content for vs. History

    private String newpreperhis;
    //Non Renewal Date

    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date notdat;
    //New content for vs. System

    private String newprepersys;
    //Liability Condition/Event - Counter Undertaking with variables holds ATX
    private String oldatxliatxtc;
    //Object of Contract Sequence C with variables holds ATX
    private String oldatxcovgodsrvc;
    //Object of Contract with variables holds ATX
    private String oldatxcovgodsrv;
    //New content for vs. System

    private String newprepercsys;
    //Document and Presentation Instructions with variables holds ATX
    private String oldatxpreper;
    //Object of Contract Sequence C without variables
    private String oldcovgodsrvc;
    //Object of Contract without variables
    private String oldcovgodsrv;
    //Old content for vs. History

    private String oldcovgodsrvhis;
    //Expiry Condition/Event with variables holds ATX
    private String oldatxexptxt;
    //Old content for vs. System

    private String oldcovgodsrvcsys;
    //Expiry Condition/Event without variables
    private String oldexptxt;
    //Old content for vs. History

    private String oldcovgodsrvchis;
    //Old content for vs. History

    private String oldexptxthis;
    //Old content for vs. History - Local Undertaking Seq. C

    private String oldnidhisc;
    //original guarantee text with variables - Local Undertaking Seq. C

    private String oldgtxnidtxtc;
    //Old content for vs. System

    private String oldcovgodsrvsys;
    //Liability Condition/Event - Counter Undertaking without variables
    private String oldliatxtc;
    //Document and Presentation Instructions with variables holds ATX
    private String oldatxpreperc;
    //Document and Presentation Instructions without variables
    private String oldpreper;
    //Old content for vs. System

    private String oldliatxtcsys;
    //Old content for vs. System - Local Undertaking Seq. C

    private String oldnidsysc;
    //Old content for vs. History

    private String oldpreperchis;
    //Old content for vs. History

    private String oldliatxtchis;
    //Document and Presentation Instructions without variables
    private String oldpreperc;
    //Old content for vs. History

    private String oldpreperhis;
    //Old content for vs. System

    private String oldprepercsys;
    //Document and Presentation Instructions
    private String preper;
    //original guarantee text without variables - Local Undertaking Seq. C

    private String oldnidtxtc;
    //Old content for vs. System

    private String oldprepersys;
    //Old content for vs. System

    private String oldexptxtsys;
    //Document and Presentation Instructions
    private String preperc;
    //Modify Document and Presentation Instructions
    private String prepercmodflg;
    //old content of purpos
    private String oldpurpos;
    //Modify Document and Presentation Instructions
    private String prepermodflg;
    //Principle Amount
    private BigDecimal wrkpcpamt = Decimals.ZERO_SCALE2;
    //Counter guarantee text - Local Undertaking Seq. C

    private String shwnidtxtpc;
    //Reimbursement Narrative
    private String rmbnar;
    //Open Principle Amount
    private BigDecimal wrkpcpopnamt = Decimals.ZERO_SCALE2;
    //Label for Additional Info in Sequence C
    private String labaddinfc;
    //Type of Request
    private String drpreflg;
    //Label for Type of Request
    private String drpreflglab;
    //Allow *
    private String chknidtxt2;
    //Allow *
    private String chknidtxtc;
    //Allow *
    private String chkliatxtc;
    //Allow *
    private String chknidtxt;
    //Allow *
    private String chkpreperc;
    //Allow *
    private String chkexptxt;
    //Allow *
    private String chkpreper;
    //bank typ
    private String bantyp;
    //Label of issue bank
    private String labissbak;
    //Label of issue bank's ref
    private String labissref;
    //InDirect Swift Add

    private IStream indirectswiadd;
    //Initial InDirect Swift Add

    private String initindirectswiadd;
    //Flg of CN
    private String chnflg;
    //面函标题
    private String lettername;
    //LETTERLABEL
    private String letterlabel;
    //Guarantee Text
    private String nidtxtmh;
    //连接海关系统标识
    private String systyp;
    //
    private String syslab;
    //银关保涵专用
    private String ameflg;
    //对手行代码
    private String oppbnkl;
    //关税保函专用
    private String ghdflg;
    //申请人名称
    private String aplnamtxt;
    //电子保函标志
    private String dzbhflg;
    //协议标志
    private String xyflg;
    //guarantee textMW

    private String nidtxtmw;
    //original guarantee text without variablesMW

    private String oldnidtxtmw;
    //original guarantee text with variablesMW

    private String oldgtxnidtxtmw;
    //Modify Guarantee TextMW
    private String nidtxtmodflgmw;

    private String shwnidtxtpmw;
    //密文面函
    private String nidtxtmhmw;
    //Label for Type of Request
    private String drpreflglab1;
    //是否以SWIFT开出
    private String swiftflg;
    //incoming lose
    private String inc760;
    //Label of apl
    private String labapl;
    //Label of CTR
    private String labctr;
    //Label of APL's ref
    private String labaplref;
    //Label of CTR's ref
    private String labctrref;
    //Country or Region Code
    private String payeecountcode;

    private String regcod;

    private String changestyle;

    private Atx atx;

    private Atx atxc;

    private Ythmod ythmod;

    private Gtx gtxmw;

    private Gtx gtx;

    private Gtx  gtx2;
    private NidVo rec;

    private NitVo blk;

    private Giacbs cbs;

    private PtsptaVo con;

    private PtsptaVo cnr;

    private PtsptaVo apc;

    private PtsptaVo ctc;

    private PtsptaVo ben;

    private PtsptaVo apl;

    private PtsptaVo ctr;

    private PtsptaVo iss;

    private PtsptaVo ada;

    private PtsptaVo bec;

    private PtsptaVo atb;

    private PtsptaVo at2;

    private PtsptaVo ct2;

    private PtsptaVo ct3;

    private PtsptaVo ct4;

    private PtsptaVo ct5;

    private PtsptaVo ap2;

    private PtsptaVo ap3;

    private PtsptaVo ap4;

    private PtsptaVo ap5;

    private PtsptaVo agt;

    private PtsptaVo tp0;

    private PtsptaVo tp1;

    private PtsptaVo tp2;

    private PtsptaVo tp3;

    private PtsptaVo tp4;

    private PtsptaVo tp5;

    private PtsptaVo tp6;

    private PtsptaVo tp7;

    private PtsptaVo tp8;

    private PtsptaVo tp9;

    private PtsptaVo oap;

    private PtsptaVo acb;

    private PtsptaVo sto;

    private PtsptaVo apr;

    private PtsptaVo avb;

    private PtsptaVo avc;

    private PtsptaVo rmb;

    private PtsptaVo rmr;

    private PtsptaVo adv;

    private GadVo gad;

    private GhdVo ghd;

    private PtsptaVo bdb;
    @Deprecated
    private Nidcxm nidcxm;

    //amount in words
    private String amtwrdtxt = NULLSTR;
    //amount formatted
    private String fmtamt = NULLSTR;
    //ordering contract amount formatted

    private String fmtorcamt = NULLSTR;
    //ordering contract percentage formatted

    private String fmtorcrat = NULLSTR;
    //Content for Tag 39C in MT 769

    private String tag39c = NULLSTR;
    //own name

    private String ownnam = NULLSTR;
    //address information obligor

    private String obladrlin = NULLSTR;
    //address information applicant

    private String apladrlin = NULLSTR;
    //address information beneficiary

    private String benadrlin = NULLSTR;
    //date of validity formated in language of guarantee text
    private String fmtexpdat = NULLSTR;
    //date from original contract formated in language of guarantee text

    private String fmtorcdat = NULLSTR;
    //latest transmission date formated in language of guarantee text

    private String fmttrmdat = NULLSTR;
    //Tender date formated in language of guarantee text

    private String fmttendat = NULLSTR;
    //Opening date formated in language of guarantee text

    private String fmtopndat = NULLSTR;
    //our liability ends date
    private String fmtliadat = NULLSTR;
    //Type Of Guarantee

    private String fmtgartyp = NULLSTR;
    //PartyType of Applicant
    private String apltypflg = NULLSTR;
    //Count of applicants
    private int aplcnt;
    //Tender closing date formated in language of guarantee text

    private String fmttenclsdat = NULLSTR;
    //Address Information Issuing Bank

    private String issadrlin = NULLSTR;
    //Stream to set the values of a field to avalable roles

    private IStream roldsc = new StreamImpl();
    //Content of Tag 23 in MT767

    private String tag23txt = NULLSTR;
    //amount in words Seq C

    private String amtwrdtxtc = NULLSTR;
    //amount formatted - Local Undertaking Seq. C

    private String fmtamtc = NULLSTR;
    //date of validity formated in language of guarantee text  - Local Undertaking Seq. C

    private String fmtexpdatc = NULLSTR;
    //Type Of Guarantee - Local Undertaking Seq. C

    private String fmtgartypc = NULLSTR;
    //Opening date formated in language of guarantee text - Local Undertaking Seq. C

    private String fmtopndatc = NULLSTR;
    //our liability ends date - Local Undertaking Seq. C

    private String fmtliadatc = NULLSTR;
    //ordering contract amount formatted - Local Undertaking Seq. C

    private String fmtorcamtc = NULLSTR;
    //date from original contract formated in language of guarantee text - Local Undertaking Seq. C

    private String fmtorcdatc = NULLSTR;
    //ordering contract percentage formatted - Local Undertaking Seq. C

    private String fmtorcratc = NULLSTR;
    //Tender closing date formated in language of guarantee text - Local Undertaking Seq. C

    private String fmttenclsdatc = NULLSTR;
    //Tender date formated in language of guarantee text - Local Undertaking Seq. C

    private String fmttendatc = NULLSTR;
    //latest transmission date formated in language of guarantee text - Local Undertaking Seq. C

    private String fmttrmdatc = NULLSTR;
    //address information obligor - Seq. C

    private String obladrlinc = NULLSTR;
    //Flag to control copying address to contract for applicant

    private String apladrcpyflg = NULLSTR;
    //use of temporary addresses for beneficiary

    private String bentmpflg = NULLSTR;
    //forbank

    private String forbank = NULLSTR;
    //GUARANTOR NAME EN

    private String guarantornamen = NULLSTR;
    //Creation date formated in language of guarantee text

    private String fmtopndat1 = NULLSTR;
    //

    private String benadrlin1 = NULLSTR;
    //GUARANTOR NAME CN

    private String guarantorcn = NULLSTR;
    //date of validity formated in language of guarantee text

    private String fmtexpdat1 = NULLSTR;
    //APL Chinese Name

    private String aplnamecn = NULLSTR;
    //APL English  Name

    private String aplnameen = NULLSTR;
    //branch  name

    private String bchnam = NULLSTR;
    //ADDRESS

    private String adr = NULLSTR;
    //TEL PHONE
    private String tel = NULLSTR;
    //BEN Chinese Name

    private String bennamecn = NULLSTR;
    //todayd

    private String todayd = NULLSTR;
    //Party type of beneficiry
    private String bentypflg = NULLSTR;
    //use of temporary addresses for APL

    private String apltmpflg = NULLSTR;
    //Order date formated in language of guarantee text

    private String fmtorddat1 = NULLSTR;
    //

    private String inudat = NULLSTR;
    //BEN EXTKEY for guarantee text
    private String benextkey = NULLSTR;
    //Issuing Bank Name

    private String issbnknam = NULLSTR;
    //区划关区名称

    private String cusnamstr = NULLSTR;
    //业务类型譧明

    private String bustyptext = NULLSTR;
    //海关全名

    private String cusnam = NULLSTR;
    //受益人海关名称汇总征税保函专用

    private String bennam = NULLSTR;
    //受益人海关个数汇总征税保函专用
    private int bencnt;
    //amount formatted汇总征税

    private String fmtamtz = NULLSTR;
    //amount in words汇总征税

    private String amtwrdtxtz = NULLSTR;
    //项目名称

    private String projectname = NULLSTR;
    //受益人统一社会信用代码

    private String benecreditcode = NULLSTR;
    //受益人统一社会信用代码密文

    private String benecreditcodemw = NULLSTR;
    //受益人名称密文

    private String beneficiarymw = NULLSTR;
    //标段编号密文

    private String bidnummw = NULLSTR;
    //标段名称密文

    private String bidnamemw = NULLSTR;
    //申请人地址

    private String agentcorpadr = NULLSTR;
    //受益人地址

    private String beneficiaryadr = NULLSTR;
    //招标文件下载地址

    private String biddocurl = NULLSTR;
    //申请书编号

    private String applicationcod = NULLSTR;
    //收槹槹率

    private String sfrate = NULLSTR;
    //手续槹金额
    private BigDecimal guaranteefeeamt = Decimals.ZERO_SCALE2;
    //项目编号
    private String projectnum = NULLSTR;
    //招标文件发售时镧

    private String inbidselltime = NULLSTR;
    //招标文件发售时镧（密文）

    private String inbidselltimemw = NULLSTR;
    //受益人地址密文

    private String beneficiaryadrmw = NULLSTR;
    //招标文件发售时?'中文

    private String fmtinbdat = NULLSTR;
    //被担保人地址

    private String warranteedr = NULLSTR;
    //保函文本申请人名称

    private String bhtaplnam = NULLSTR;
    //保函文本申请人地址

    private String bhtapladr = NULLSTR;
    //经办行传真

    private String fax = NULLSTR;
    //申请人名称

    private String agentcorpname = NULLSTR;
    //被担保人统一社会信用证代码

    private String warcreditcode = NULLSTR;
    //标段编号

    private String bidnum = NULLSTR;
    //标段名称

    private String bidname = NULLSTR;

    // 标识来自于北京电力
    private String send = NULLSTR;
    //经办行地址

    private String jbhadr = NULLSTR;
    //合肥保函明文受益人名称

    private String dbhbennam = NULLSTR;
    //合肥保函密文受益人名称
    private String dbhbenammw = NULLSTR;
    //开标日期
    private Date kbdate;
    //开标日期
    private String kbrq = NULLSTR;
    //合同号
    private String hforcref = NULLSTR;

    private String bdsght;

    // 云平台保函消息类型
    private String msgTyp;

    public void reset() {
        if (rec == null) {
            rec = new NidVo();
        }
        if (blk == null) {
            blk = new NitVo();
        }
        if (cbs == null) {
            cbs = new Giacbs();
        }
        cbs.reset();
        if (con == null) {
			con = new PtsptaVo();
        }
		con.reset();
        if (cnr == null) {
			cnr = new PtsptaVo();
        }
		cnr.reset();
        if (apc == null) {
			apc = new PtsptaVo();
        }
		apc.reset();
        if (ctc == null) {
			ctc = new PtsptaVo();
        }
		ctc.reset();
        if (ben == null) {
            ben = new PtsptaVo();
        }
        ben.reset();
        if (adv == null) {
            adv = new PtsptaVo();
        }
        adv.reset();
        if (apl == null) {
            apl = new PtsptaVo();
        }
        apl.reset();

    }

    private Set<String> modifySet = new HashSet<>();

    public boolean isModified(String key){
        return modifySet.contains(key);
    }

}
