"use strict";var a=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var l=(r,t,e)=>t in r?a(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var m=(r,t)=>{for(var e in t)a(r,e,{get:t[e],enumerable:!0})},y=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of f(t))!u.call(r,o)&&o!==e&&a(r,o,{get:()=>t[o],enumerable:!(n=h(t,o))||n.enumerable});return r};var x=r=>y(a({},"__esModule",{value:!0}),r);var p=(r,t,e)=>l(r,typeof t!="symbol"?t+"":t,e);var T={};m(T,{DynamicTypeMapper:()=>c});module.exports=x(T);function i(r){throw new Error("Unexpected value: "+JSON.stringify(r))}var s=class{constructor(t){p(this,"ctx");this.ctx=t}get generation(){return this.ctx.generation}get csharp(){return this.generation.csharp}get settings(){return this.generation.settings}get constants(){return this.generation.constants}get namespaces(){return this.generation.namespaces}get names(){return this.generation.names}get types(){return this.generation.types}get extern(){return this.generation.extern}get model(){return this.generation.model}get registry(){return this.generation.registry}get System(){return this.extern.System}get NUnit(){return this.extern.NUnit}get OneOf(){return this.extern.OneOf}get Google(){return this.extern.Google}};var c=class extends s{constructor({context:e}){super(e);p(this,"context");this.context=e}convert(e){switch(e.typeReference.type){case"list":return this.csharp.Type.list(this.convert({typeReference:e.typeReference,unboxOptionals:!0}));case"literal":return this.convertLiteral({literal:e.typeReference.value});case"map":return this.csharp.Type.map(this.convert({typeReference:e.typeReference.key}),this.convert({typeReference:e.typeReference.value}));case"named":{let n=this.context.resolveNamedType({typeId:e.typeReference.value});return n==null?this.convertUnknown():this.convertNamed({named:n})}case"optional":case"nullable":{let n=this.convert({typeReference:e.typeReference.value});return e.unboxOptionals?n.unwrapIfOptional():this.csharp.Type.optional(n)}case"primitive":return this.convertPrimitive({primitive:e.typeReference.value});case"set":return this.csharp.Type.set(this.convert({typeReference:e.typeReference,unboxOptionals:!0}));case"unknown":return this.convertUnknown();default:i(e.typeReference)}}convertToClassReference(e){return this.csharp.classReference({origin:e.declaration,namespace:this.context.getNamespace(e.declaration.fernFilepath)})}convertNamed({named:e}){switch(e.type){case"alias":return this.convert({typeReference:e.typeReference});case"enum":case"object":return this.csharp.Type.reference(this.csharp.classReference({origin:e.declaration,namespace:this.context.getNamespace(e.declaration.fernFilepath)}));case"discriminatedUnion":return this.settings.shouldGeneratedDiscriminatedUnions?this.csharp.Type.reference(this.csharp.classReference({origin:e.declaration,namespace:this.context.getNamespace(e.declaration.fernFilepath)})):this.csharp.Type.object;case"undiscriminatedUnion":return this.csharp.Type.oneOf(e.types.map(n=>this.convert({typeReference:n})));default:i(e)}}convertLiteral({literal:e}){switch(e.type){case"boolean":return this.csharp.Type.boolean;case"string":return this.csharp.Type.string}}convertUnknown(){return this.csharp.Type.object}convertPrimitive({primitive:e}){switch(e){case"INTEGER":return this.csharp.Type.integer;case"UINT":return this.csharp.Type.uint;case"LONG":return this.csharp.Type.long;case"UINT_64":return this.csharp.Type.ulong;case"FLOAT":return this.csharp.Type.float;case"DOUBLE":return this.csharp.Type.double;case"BOOLEAN":return this.csharp.Type.boolean;case"STRING":return this.csharp.Type.string;case"DATE":return this.csharp.Type.dateOnly;case"DATE_TIME":return this.csharp.Type.dateTime;case"UUID":return this.csharp.Type.string;case"BASE_64":return this.csharp.Type.string;case"BIG_INTEGER":return this.csharp.Type.string;default:i(e)}}};0&&(module.exports={DynamicTypeMapper});
//# sourceMappingURL=DynamicTypeMapper.cjs.map