// 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; /// /// How the extracted text was produced. /// [JsonConverter(typeof(ExtractionMethodJsonConverter))] public enum ExtractionMethod { [JsonPropertyName("native")] Native, [JsonPropertyName("ocr")] Ocr, [JsonPropertyName("mixed")] Mixed, } /// /// Custom JSON converter for that respects explicit variant names. /// internal sealed class ExtractionMethodJsonConverter : JsonConverter { public override ExtractionMethod Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { var value = reader.GetString(); return value switch { "native" => ExtractionMethod.Native, "ocr" => ExtractionMethod.Ocr, "mixed" => ExtractionMethod.Mixed, _ => throw new JsonException($"Unknown ExtractionMethod value: {value}") }; } public override void Write(Utf8JsonWriter writer, ExtractionMethod value, JsonSerializerOptions options) { var str = value switch { ExtractionMethod.Native => "native", ExtractionMethod.Ocr => "ocr", ExtractionMethod.Mixed => "mixed", _ => throw new JsonException($"Unknown ExtractionMethod value: {value}") }; writer.WriteStringValue(str); } }