{
  "name": "internal_billing_export",
  "display_name": "Internal Billing System Export (HIS / POS / PMS)",
  "source_role": "internal_system",
  "file_format": "xlsx",
  "fields": [
    {
      "canonical": "pg_transaction_id",
      "aliases": ["PG_Transaction_ID", "PG Transaction ID", "Gateway Txn ID"],
      "required": false,
      "normalize": [{ "step": "trim" }]
    },
    {
      "canonical": "amount",
      "aliases": ["Amount", "Bill Amount", "Paid Amount"],
      "dtype": "number",
      "normalize": [{ "step": "strip_chars", "chars": [",", "₹"] }, { "step": "to_number" }]
    },
    {
      "canonical": "card_last4",
      "aliases": ["card_no_cheque", "Card No/Cheque", "Card Number"],
      "required": false,
      "normalize": [{ "step": "trim" }, { "step": "strip_chars", "chars": [" "] }, { "step": "last4" }]
    },
    {
      "canonical": "rrn",
      "aliases": ["Txn ref no.(RRN)", "RRN", "Reference No"],
      "required": false,
      "normalize": [{ "step": "trim" }, { "step": "strip_chars", "chars": ["'"] }, { "step": "lpad", "length": 12, "fill": "0" }]
    },
    {
      "canonical": "approval_code",
      "aliases": ["Approval_No", "Approval No", "Auth Code"],
      "required": false,
      "normalize": [{ "step": "trim" }, { "step": "lpad", "length": 6, "fill": "0" }]
    },
    {
      "canonical": "payment_mode",
      "aliases": ["Payment Mode", "Pay Mode", "paymode"],
      "required": false,
      "normalize": [{ "step": "trim" }, { "step": "upper" }]
    },
    {
      "canonical": "reference_name",
      "aliases": ["Patient_Name", "Patient Name", "Customer Name", "Guest Name"],
      "required": false,
      "normalize": [{ "step": "trim" }]
    },
    {
      "canonical": "txn_date",
      "aliases": ["Doc Date", "Bill Date", "Transaction Date", "Date"],
      "required": false,
      "dtype": "date",
      "normalize": [{ "step": "date_parse", "formats": ["%d-%m-%Y", "%d/%m/%Y", "%Y-%m-%d"] }]
    },
    {
      "canonical": "location",
      "aliases": ["Unit/Location", "Unit", "Branch", "Centre", "Store", "Outlet"],
      "required": false,
      "normalize": [{ "step": "trim" }, { "step": "value_map", "map_ref": "location_map" }]
    }
  ]
}
