import{h as n,i as r,m as s}from"./chunk-ZDZZCKFB.js";var a=class extends s{constructor({context:e}){super(e);n(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 t=this.context.resolveNamedType({typeId:e.typeReference.value});return t==null?this.convertUnknown():this.convertNamed({named:t})}case"optional":case"nullable":{let t=this.convert({typeReference:e.typeReference.value});return e.unboxOptionals?t.unwrapIfOptional():this.csharp.Type.optional(t)}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:r(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(t=>this.convert({typeReference:t})));default:r(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:r(e)}}};export{a};
//# sourceMappingURL=chunk-F3KILROP.js.map