using System.Text.Json;
namespace JsonContextDb.JsonContext;
///
/// Configuration options for , controlling JSON serialization and file naming.
///
///
/// This class allows customization of how serializes entities to JSON and names the output files.
/// Instances of this class are typically provided during initialization and should not be modified
/// afterward to ensure consistent behavior. The default settings enable indented JSON output and generate file names based on
/// the entity type name (e.g., "Customer.json" for a Customer type).
///
public class DbContextOptions
{
///
/// Gets or sets the JSON serialization options used for reading and writing entities.
///
///
/// The default value is a instance with WriteIndented set to true for readable JSON output.
/// Customizing this property allows control over serialization behavior, such as case sensitivity or property naming.
/// This property must not be null when used by .
///
/// Thrown if set to null.
public JsonSerializerOptions SerializerOptions { get; set; } = new() { WriteIndented = true };
///
/// Gets or sets a factory function that generates file names based on entity types.
///
///
/// The default factory generates file names in the format "{TypeName}.json" (e.g., "Customer.json" for a Customer type).
/// Customizing this function allows for alternative naming conventions, such as including subdirectories or different extensions.
/// The function must return a valid file name and should not return null or empty strings.
/// This property must not be null when used by .
///
/// Thrown if set to null.
public Func FileNameFactory { get; set; } = type => $"{type.Name}.json";
}