import t from"../account/AccountId.js";import i from"../Key.js";import e,{TRANSACTION_REGISTRY as n}from"../transaction/Transaction.js";import s from"./ServiceEndpoint.js";class r extends e{constructor(t){super(),this._accountId=null!=t?.accountId?t.accountId:null,this._description=null!=t?.description?t.description:null,this._gossipEndpoints=null!=t?.gossipEndpoints?t.gossipEndpoints:null,this._serviceEndpoints=null!=t?.serviceEndpoints?t.serviceEndpoints:null,this._gossipCaCertificate=null!=t?.gossipCaCertificate?t.gossipCaCertificate:null,this._grpcCertificateHash=null!=t?.grpcCertificateHash?t.grpcCertificateHash:null,this._adminKey=null!=t?.adminKey?t.adminKey:null,this._declineReward=null!=t?.declineReward?t.declineReward:null}static _fromProtobuf(n,o,a,c,d){const u=d[0].nodeCreate;return e._fromProtobufTransactions(new r({accountId:null!=u.accountId?t._fromProtobuf(u.accountId):void 0,description:null!=u.description?u.description:void 0,gossipEndpoints:null!=u.gossipEndpoint?u.gossipEndpoint.map((t=>s._fromProtobuf(t))):void 0,serviceEndpoints:null!=u.serviceEndpoint?u.serviceEndpoint.map((t=>s._fromProtobuf(t))):void 0,gossipCaCertificate:null!=u.gossipCaCertificate?u.gossipCaCertificate:void 0,grpcCertificateHash:null!=u.grpcCertificateHash?u.grpcCertificateHash:void 0,adminKey:null!=u.adminKey?i._fromProtobufKey(u.adminKey):void 0,declineReward:null!=u.declineReward?u.declineReward:void 0}),n,o,a,c,d)}setAccountId(i){return this._requireNotFrozen(),this._accountId=i instanceof t?i:t.fromString(i),this}get accountId(){return this._accountId}setDescription(t){if(this._requireNotFrozen(),t.length>100)throw new Error("Description must be at most 100 characters.");return this._description=t,this}get description(){return this._description}setGossipEndpoints(t){if(this._requireNotFrozen(),0==t.length)throw new Error("GossipEndpoints list must not be empty.");if(t.length>10)throw new Error("GossipEndpoints list must not contain more than 10 entries.");return this._gossipEndpoints=[...t],this}get gossipEndpoints(){return this._gossipEndpoints}addGossipEndpoint(t){return null!=this._gossipEndpoints&&this._gossipEndpoints.push(t),this}setServiceEndpoints(t){if(this._requireNotFrozen(),0==t.length)throw new Error("ServiceEndpoints list must not be empty.");if(t.length>8)throw new Error("ServiceEndpoints list must not contain more than 8 entries.");return this._serviceEndpoints=[...t],this}get serviceEndpoints(){return this._serviceEndpoints}addServiceEndpoint(t){return null!=this._serviceEndpoints&&this._serviceEndpoints.push(t),this}setGossipCaCertificate(t){if(this._requireNotFrozen(),0==t.length)throw new Error("GossipCaCertificate must not be empty.");return this._gossipCaCertificate=t,this}get gossipCaCertificate(){return this._gossipCaCertificate}setCertificateHash(t){return this._requireNotFrozen(),this._grpcCertificateHash=t,this}get certificateHash(){return this._grpcCertificateHash}setAdminKey(t){return this._requireNotFrozen(),this._adminKey=t,this}get adminKey(){return this._adminKey}setDeclineReward(t){return this._requireNotFrozen(),this._declineReward=t,this}get declineReward(){return this._declineReward}_execute(t,i){return t.addressBook.createNode(i)}_getTransactionDataCase(){return"nodeCreate"}_makeTransactionData(){return{accountId:null!=this._accountId?this._accountId._toProtobuf():null,description:null!=this._description?this._description:null,gossipEndpoint:null!=this._gossipEndpoints?this._gossipEndpoints.map((t=>t._toProtobuf())):null,serviceEndpoint:null!=this._serviceEndpoints?this._serviceEndpoints.map((t=>t._toProtobuf())):null,gossipCaCertificate:null!=this._gossipCaCertificate?this._gossipCaCertificate:null,grpcCertificateHash:null!=this._grpcCertificateHash?this._grpcCertificateHash:null,adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,declineReward:null!=this._declineReward?this._declineReward:null}}_getLogId(){return`NodeCreateTransaction:${this._transactionIds.current.validStart.toString()}`}}n.set("nodeCreate",r._fromProtobuf);export{r as default};
//# sourceMappingURL=NodeCreateTransaction.js.map
