{
  "apiVersion": 56,
  "label": "Credits — Lifecycle on Approval Decision",
  "description": "Phase 1 lifecycle Flow. When the approval engine flips Approval_Status__c on a Credits record, this Flow routes the Credit_Lifecycle__c based on the outcome: Approved → Active (credits granted, not yet provisioned on Cloud), Rejected → Cancelled. Active → Provisioned and Provisioned → Completed transitions are NOT handled here — Sales Ops flips those manually in Phase 1 (Cloud-billing webhook integration that would auto-stamp Provisioned is Phase 2). No Start_Date stamp anymore — the AE-filled Effective_Date__c is the authoritative effective-on field. Zero external calls; pure local field update. See docs/object-proposals/poc-credits-refactor.md §6 / §7.",
  "processType": "AutoLaunchedFlow",
  "status": "Active",
  "start": {
    "object": "Credits__c",
    "triggerType": "RecordBeforeSave",
    "recordTriggerType": "Update",
    "filterLogic": "and",
    "filters": [
      {"field": "Approval_Status__c", "operator": "IsChanged", "value": {"booleanValue": true}}
    ],
    "connector": {"targetReference": "Route_By_Approval_Outcome"}
  },
  "decisions": [
    {
      "name": "Route_By_Approval_Outcome",
      "label": "Route by Approval_Status outcome",
      "locationX": 200,
      "locationY": 50,
      "rules": [
        {
          "name": "outcome_approved",
          "label": "Approved → Active",
          "conditionLogic": "and",
          "conditions": [
            {"leftValueReference": "$Record.Approval_Status__c", "operator": "EqualTo", "rightValue": {"stringValue": "Approved"}}
          ],
          "connector": {"targetReference": "Set_Active"}
        },
        {
          "name": "outcome_rejected",
          "label": "Rejected → Cancelled",
          "conditionLogic": "and",
          "conditions": [
            {"leftValueReference": "$Record.Approval_Status__c", "operator": "EqualTo", "rightValue": {"stringValue": "Rejected"}}
          ],
          "connector": {"targetReference": "Set_Cancelled"}
        }
      ],
      "defaultConnectorLabel": "Other outcome (Pending / NotSubmitted / NeedsTriage) — no lifecycle change"
    }
  ],
  "assignments": [
    {
      "name": "Set_Active",
      "label": "Set Credit_Lifecycle = Active",
      "locationX": 100,
      "locationY": 200,
      "assignmentItems": [
        {"assignToReference": "$Record.Credit_Lifecycle__c", "operator": "Assign", "value": {"stringValue": "Active"}}
      ]
    },
    {
      "name": "Set_Cancelled",
      "label": "Set Credit_Lifecycle = Cancelled",
      "locationX": 300,
      "locationY": 200,
      "assignmentItems": [
        {"assignToReference": "$Record.Credit_Lifecycle__c", "operator": "Assign", "value": {"stringValue": "Cancelled"}}
      ]
    }
  ]
}
