import{a as p}from"./chunk-CDMZ2O62.js";import{c as a}from"./chunk-D2D544ZS.js";import{a as c}from"./chunk-F3KILROP.js";import{a as m}from"./chunk-MM7AFFVF.js";import{h as r,n as o}from"./chunk-ZDZZCKFB.js";var l=class h extends a{constructor({ir:e,config:t,options:n,generation:s}){super({ir:e,config:t,options:n});r(this,"ir");r(this,"dynamicTypeMapper");r(this,"dynamicTypeLiteralMapper");r(this,"filePropertyMapper");r(this,"generation");this.ir=e,this.generation=s!=null?s:new o(e,t.workspaceName,t.customConfig!=null?t.customConfig:{},t),this.dynamicTypeMapper=new c({context:this}),this.dynamicTypeLiteralMapper=new p({context:this}),this.filePropertyMapper=new m({context:this})}get namespaces(){return this.generation.namespaces}get registry(){return this.generation.registry}get extern(){return this.generation.extern}get settings(){return this.generation.settings}get constants(){return this.generation.constants}get names(){return this.generation.names}get types(){return this.generation.types}get model(){return this.generation.model}get csharp(){return this.generation.csharp}get System(){return this.extern.System}get NUnit(){return this.extern.NUnit}get OneOf(){return this.extern.OneOf}get Google(){return this.extern.Google}clone(){return new h({ir:this.ir,config:this.config,options:this.options,generation:this.generation})}getFileParameterForString(e){return this.csharp.TypeLiteral.reference(this.csharp.instantiateClass({classReference:this.types.FileParameter,arguments_:[],properties:[{name:"Stream",value:this.getMemoryStreamForString(e)}],multiline:!0}))}getMemoryStreamForString(e){return this.extern.System.IO.MemoryStream.new({arguments_:[this.csharp.invokeMethod({on:this.extern.System.Text.Encoding_UTF8,method:"GetBytes",arguments_:[this.csharp.TypeLiteral.string(e)]})]})}getClassName(e){return e.pascalCase.safeName}getParameterName(e){return e.camelCase.safeName}getPropertyName(e){return e.pascalCase.safeName}getMethodName(e){return`${e.pascalCase.safeName}Async`}getNamespace(e,t){let n=this.getNamespaceSegments(e);return n=t!=null?[...n,t]:n,[this.namespaces.root,...n].join(".")}getEnvironmentTypeReferenceFromID(e){let t=this.resolveEnvironmentName(e);if(t!=null)return this.getEnvironmentClassReferenceForEnumName(t)}getEnvironmentClassReferenceForEnumName(e){return this.csharp.classReference({name:`${this.generation.types.Environments.name}.${this.getClassName(e)}`,namespace:this.namespaces.root})}getNamespaceSegments(e){return(this.settings.explicitNamespaces?e.allParts:e.packagePath).map(n=>n.pascalCase.safeName)}precalculate(e){this.generation.initialize(),this.extern.System.Collections.Generic.KeyValuePair(),this.extern.System.Collections.Generic.IEnumerable(),this.extern.System.Collections.Generic.IAsyncEnumerable(),this.extern.System.Collections.Generic.HashSet(),this.extern.System.Collections.Generic.List(),this.extern.System.Collections.Generic.Dictionary(),this.extern.System.Threading.Tasks.Task(),Object.entries(this.ir.types).sort((t,n)=>t[0].length-n[0].length).forEach(([t,n])=>{this.dynamicTypeMapper.convertToClassReference(n)});for(let[t,n]of e.entries())if(this.csharp.classReference({origin:this.model.staticExplicit(`Example${t}`),namespace:"Usage"}),n.endpoint){let s=this.resolveEndpointLocation(n.endpoint);for(let i of s)switch(i.request.type){case"inlined":this.csharp.classReference({origin:i.request.declaration.name,namespace:this.getNamespace(i.request.declaration.fernFilepath)});break;case"body":break}}this.generation.types.ClientOptions,this.generation.types.RootClient,this.csharp.freezeClassReferences()}};export{l as a};
//# sourceMappingURL=chunk-PBYJXQQK.js.map