# ============================================================
# LAKELOGIC DATA CONTRACT — BRONZE LAYER
# Generated by Contract Studio from template: bronze_ingest
# ============================================================

version: "1.0.0"

info:
  title: "{{ title }}"
  version: "1.0.0"
  description: "{{ description | default('Raw ingestion contract — Bronze layer') }}"
  target_layer: "bronze"
  domain: "{{ domain }}"
  system: "{{ system }}"

dataset: "{{ dataset_name }}"
{%- if primary_key %}
primary_key: {{ primary_key | tojson }}
{%- endif %}

# ── Source Configuration ───────────────────────────────────────
source:
  type: "{{ source_type | default('csv') }}"
  path: "{{ source_path | default('') }}"

# ── Server (Ingest Mode) ──────────────────────────────────────
server:
  mode: ingest
  cast_to_string: true
  schema_evolution: append
  allow_schema_drift: true

# ── Schema Model ──────────────────────────────────────────────
model:
  fields:
{%- for field in fields %}
    - name: "{{ field.name }}"
      type: "string"
      required: {{ field.required | default(false) | tojson }}
{%- if field.description %}
      description: "{{ field.description }}"
{%- endif %}
{%- endfor %}

# ── Quality Rules ─────────────────────────────────────────────
# Bronze = raw landing zone. No enforcement — rules live in Silver.
quality:
  enforce_required: false

# ── Quarantine ────────────────────────────────────────────────
quarantine:
  enabled: true
  include_error_reason: true

# ── Materialization ───────────────────────────────────────────
materialization:
  strategy: "{{ materialization_strategy | default('append') }}"
  format: "{{ materialization_format | default('delta') }}"
  target_path: "{{ target_path | default('') }}"

# ── Lineage ───────────────────────────────────────────────────
lineage:
  enabled: true
  capture_source_path: true
  capture_timestamp: true
  capture_run_id: true
