// This file is auto-generated by alef. DO NOT EDIT. // alef:hash:4e15143f4af1ae8bafbdb1506ef057da924484c66a19483966333558ad437e75 #nullable enable using System; using System.Text.Json; using System.Text.Json.Serialization; namespace Kreuzberg; /// /// Content rendering mode for code extraction. /// /// Controls how extracted code content is represented in the `content` field /// of `ExtractionResult`. /// [JsonConverter(typeof(CodeContentModeJsonConverter))] public enum CodeContentMode { /// /// Use TSLP semantic chunks as content (default). /// [JsonPropertyName("chunks")] Chunks, /// /// Use raw source code as content. /// [JsonPropertyName("raw")] Raw, /// /// Emit function/class headings + docstrings (no code bodies). /// [JsonPropertyName("structure")] Structure, } /// /// Custom JSON converter for that respects explicit variant names. /// internal sealed class CodeContentModeJsonConverter : JsonConverter { public override CodeContentMode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { var value = reader.GetString(); return value switch { "chunks" => CodeContentMode.Chunks, "raw" => CodeContentMode.Raw, "structure" => CodeContentMode.Structure, _ => throw new JsonException($"Unknown CodeContentMode value: {value}") }; } public override void Write(Utf8JsonWriter writer, CodeContentMode value, JsonSerializerOptions options) { var str = value switch { CodeContentMode.Chunks => "chunks", CodeContentMode.Raw => "raw", CodeContentMode.Structure => "structure", _ => throw new JsonException($"Unknown CodeContentMode value: {value}") }; writer.WriteStringValue(str); } }