# Storage Configuration Schema
# Common schema for storage backends (filesystem, RocksDB, etc.)

{
  # Supported storage backends

  StorageConfig = {
    # Storage backend type
    backend | String,

    # Base storage path (for local backends)
    path | String | optional,

    # Caching Configuration
    cache | {
      # Enable caching
      enabled | Bool | default = true,

      # Cache type (in_memory, disk, hybrid)
      type | String | optional,

      # Cache size in bytes
      size | Number | optional,

      # Cache eviction policy (lru, lfu, fifo)
      eviction_policy | String | optional,

      # Cache TTL in seconds
      ttl | Number | optional,
    } | optional,

    # Compression Configuration
    compression | {
      # Enable compression
      enabled | Bool | default = false,

      # Compression algorithm (gzip, snappy, zstd)
      algorithm | String | optional,

      # Compression level (1-9)
      level | Number | optional,

      # Minimum size to compress (bytes)
      min_size | Number | optional,
    } | optional,

    # Backup Configuration
    backup | {
      # Enable automatic backups
      enabled | Bool | default = false,

      # Backup interval in seconds
      interval | Number | optional,

      # Backup directory path
      path | String | optional,

      # Maximum backups to retain
      max_backups | Number | optional,

      # Enable incremental backups
      incremental | Bool | default = false,
    } | optional,

    # Replication Configuration (for HA)
    replication | {
      # Enable replication
      enabled | Bool | default = false,

      # Replication mode (sync, async)

      # Replica nodes (addresses)
      replicas | Array String | optional,

      # Replication timeout in seconds
      timeout | Number | optional,
    } | optional,

    # Garbage Collection
    garbage_collection | {
      # Enable GC
      enabled | Bool | default = true,

      # GC interval in seconds
      interval | Number | optional,

      # Retention period in seconds
      retention | Number | optional,
    } | optional,

    # Statistics/Metrics
    statistics | {
      # Enable storage statistics
      enabled | Bool | default = false,

      # Stats collection interval in seconds
      interval | Number | optional,

      # Track per-operation timing
      operation_timing | Bool | default = false,
    } | optional,
  },
}
