"use strict";module.exports=Method;var ReflectionObject=require("./object");((Method.prototype=Object.create(ReflectionObject.prototype)).constructor=Method).className="Method";var util=require("./util");function Method(e,t,s,o,r,i,p,n,h){if(util.isObject(r)?(p=r,r=i=void 0):util.isObject(i)&&(p=i,i=void 0),!(void 0===t||util.isString(t)))throw TypeError("type must be a string");if(!util.isString(s))throw TypeError("requestType must be a string");if(!util.isString(o))throw TypeError("responseType must be a string");ReflectionObject.call(this,e,p),this.type=t||"rpc",this.requestType=s,this.requestStream=!!r||void 0,this.responseType=o,this.responseStream=!!i||void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=n,this.parsedOptions=h}Method.fromJSON=function(e,t){return new Method(e,t.type,t.requestType,t.responseType,t.requestStream,t.responseStream,t.options,t.comment,t.parsedOptions)},Method.prototype.toJSON=function(e){var t=!!e&&!!e.keepComments;return util.toObject(["type","rpc"!==this.type&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",t?this.comment:void 0,"parsedOptions",this.parsedOptions])},Method.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),ReflectionObject.prototype.resolve.call(this))};