# | Core lib instances (defaults only)
# | Migrated from: provisioning/kcl/lib.k
# | Pattern: Hybrid - defaults + makers + direct access (contracts available via import)

let contracts_lib = import "./contracts.ncl" in
let defaults_lib = import "./defaults.ncl" in

{
  # ============================================================================
  # SECTION 0: Contracts (schema definitions)
  # Use when: Validating and type-checking records
  # Exported: YES - for contract application via `| contracts.Storage`
  # ============================================================================
  Storage = contracts_lib.Storage,
  StorageVol = contracts_lib.StorageVol,
  TaskServDef = contracts_lib.TaskServDef,
  ClusterDef = contracts_lib.ClusterDef,
  ScaleData = contracts_lib.ScaleData,
  ScaleResource = contracts_lib.ScaleResource,

  # ============================================================================
  # SECTION 1: Direct access to defaults (for reference)
  # Use when: Understanding default values, building custom instances manually
  # Exported: YES - for inspection and custom building
  # ============================================================================
  defaults = defaults_lib,

  # ============================================================================
  # SECTION 2: Convenience makers (90% of use cases)
  # Use when: Creating instances with overrides, simple customization
  # Note: Not exported to TOML/JSON (functions aren't serializable)
  #       Import lib.ncl in Nickel code and use these functions
  # ============================================================================

  make_storage_vol | not_exported = fun overrides =>
    defaults_lib.storage_vol & overrides,

  make_storage | not_exported = fun overrides =>
    defaults_lib.storage & overrides,

  make_taskserv_def | not_exported = fun overrides =>
    defaults_lib.taskserv_def & overrides,

  make_cluster_def | not_exported = fun overrides =>
    defaults_lib.cluster_def & overrides,

  make_scale_data | not_exported = fun overrides =>
    defaults_lib.scale_data & overrides,

  make_scale_resource | not_exported = fun overrides =>
    defaults_lib.scale_resource & overrides,

  # ============================================================================
  # SECTION 3: Default instances (bare defaults)
  # Use when: Need unmodified default values
  # Exported: YES - for direct use without customization
  # ============================================================================
  DefaultStorageVol = defaults_lib.storage_vol,
  DefaultStorage = defaults_lib.storage,
  DefaultTaskServDef = defaults_lib.taskserv_def,
  DefaultClusterDef = defaults_lib.cluster_def,
  DefaultScaleData = defaults_lib.scale_data,
  DefaultScaleResource = defaults_lib.scale_resource,
}
