diff --git a/src/MongoDB.Driver/Encryption/CsfleSchemaBuilder.cs b/src/MongoDB.Driver/Encryption/CsfleSchemaBuilder.cs index f1afea5296..a3e10f7f30 100644 --- a/src/MongoDB.Driver/Encryption/CsfleSchemaBuilder.cs +++ b/src/MongoDB.Driver/Encryption/CsfleSchemaBuilder.cs @@ -23,6 +23,7 @@ using MongoDB.Bson.Serialization; namespace MongoDB.Driver.Encryption { //TODO Add docs + //TODO BsonType can be multiple types in some cases /// /// @@ -373,6 +374,92 @@ namespace MongoDB.Driver.Encryption } } + public class ElementBuilder where TSelf : ElementBuilder + { + private CsfleEncryptionAlgorithm _algorithm; + private Guid _keyId; + + public TSelf WithKeyId(Guid keyId) + { + _keyId = keyId; + return (TSelf)this; + } + + public TSelf WithAlgorithm(CsfleEncryptionAlgorithm algorithm) + { + _algorithm = algorithm; + return (TSelf)this; + } + } + + public class EncryptMetadataBuilder : ElementBuilder + { + + } + + public abstract class PropertyBuilder: ElementBuilder> + { + } + + public class PropertyBuilder : PropertyBuilder + { + private readonly FieldDefinition _path; + private List _bsonTypes; + + public PropertyBuilder(FieldDefinition path) + { + _path = path; + } + + public PropertyBuilder WithBsonType(BsonType bsonType) + { + _bsonTypes = [bsonType]; + return this; + } + + public PropertyBuilder WithBsonTypes(IEnumerable bsonTypes) + { + _bsonTypes = [..bsonTypes]; + return this; + } + } + + public abstract class NestedDocumentBuilder: ElementBuilder + { + } + + public class NestedDocumentBuilder : NestedDocumentBuilder + { + private readonly FieldDefinition _path; + private readonly Action> _configure; + + public NestedDocumentBuilder(FieldDefinition path, Action> configure) + { + _path = path; + _configure = configure; + } + } + + public class TypedBuilder + { + private readonly List _nestedDocument = []; + private readonly List _properties = []; + private EncryptMetadataBuilder _metadata; + + public EncryptMetadataBuilder EncryptMetadata() + { + _metadata = new EncryptMetadataBuilder(); + return _metadata; + } + + public PropertyBuilder Property(FieldDefinition path) + { + var property = new PropertyBuilder(path); + _properties.Add(property); + return property; + } + } + /// /// The type of possible encryption algorithms. ///