{
  "version": 1,
  "description": "Frontend-aligned backend probe cases. These mirror the current frontend's real request paths and payload shapes.",
  "cases": [
    {
      "id": "FE-OPP-001",
      "name": "Opportunity products related list query",
      "mutates_data": false,
      "description": "Mirrors the Opportunity detail related list request built by RelatedList + useRecordList.",
      "frontend_sources": [
        "frontend/src/features/record/components/RelatedList.tsx",
        "frontend/src/core/hooks/useRecordList.ts"
      ],
      "required_vars": [
        "OpportunityId"
      ],
      "steps": [
        {
          "name": "Load OpportunityLineItems through the frontend-aligned SOQL query path",
          "method": "GET",
          "endpoint": "/services/data/v63.0/query/?q=SELECT+Id,OpportunityId,PricebookEntryId,Product2Id,ListPrice,Discount,Unit_Net_Price__c,Quantity,Net_Fees__c,Service_Start_Date__c,Service_End_Date__c+FROM+OpportunityLineItem+WHERE+OpportunityId='{OpportunityId}'+ORDER+BY+CreatedDate+DESC+LIMIT+50",
          "expected_status": 200,
          "extract": {
            "OpportunityLineItemCount": "totalSize"
          }
        }
      ]
    },
    {
      "id": "FE-QTO-001",
      "name": "Opportunity detail Create Quote action",
      "mutates_data": true,
      "description": "Mirrors clicking the Create Quote button from the Opportunity record page, then loading Quote detail and Quote Products.",
      "frontend_sources": [
        "frontend/src/registries/ActionRegistry.ts",
        "frontend/src/infrastructure/api/data/actions.ts",
        "backend/internal/controlplane/packs/standard_actions.json",
        "backend/internal/features/metadata/virtual_relationships.go"
      ],
      "required_vars": [
        "OpportunityId"
      ],
      "variables": {
        "CreateQuoteActionId": "act_opportunity_createquote"
      },
      "steps": [
        {
          "name": "Execute the standard createRecord action used by the frontend Create Quote button",
          "method": "POST",
          "endpoint": "/services/data/v63.0/actions/standard/createRecord",
          "payload": {
            "inputs": [
              {
                "actionId": "{CreateQuoteActionId}",
                "recordId": "{OpportunityId}"
              }
            ]
          },
          "expected_status": 200,
          "extract": {
            "QuoteId": "0.outputValues.record.Id",
            "QuoteNumber": "0.outputValues.record.QuoteNumber",
            "AccountId": "0.outputValues.record.AccountId"
          }
        },
        {
          "name": "Load Quote record detail after frontend navigation",
          "method": "GET",
          "endpoint": "/services/data/v63.0/sobjects/Quote/{QuoteId}",
          "expected_status": 200
        },
        {
          "name": "Load Quote Products related list through the virtual quote_product__c backing object",
          "method": "GET",
          "endpoint": "/services/data/v63.0/query/?q=SELECT+Id,Quote__c,Product__c,List_Price__c,Discount__c,Unit_Net_Price__c,Quantity__c,NetFees__c,Service_Start_Date__c,Service_End_Date__c+FROM+quote_product__c+WHERE+Quote__c='{QuoteId}'+ORDER+BY+CreatedDate+DESC+LIMIT+50",
          "expected_status": 200,
          "extract": {
            "QuoteProductCount": "totalSize"
          }
        }
      ]
    },
    {
      "id": "FE-APR-001",
      "name": "Submit Quote for Approval modal",
      "mutates_data": true,
      "description": "Mirrors the SubmitApprovalModal payload shape the frontend sends.",
      "frontend_sources": [
        "frontend/src/features/approvals/components/SubmitApprovalModal.tsx",
        "frontend/src/infrastructure/api/approvals.ts"
      ],
      "required_vars": [
        "QuoteId"
      ],
      "steps": [
        {
          "name": "Submit the Quote for approval through the frontend-aligned approvals endpoint",
          "method": "POST",
          "endpoint": "/services/data/v63.0/process/approvals",
          "payload": {
            "ObjectApiName": "Quote",
            "RecordId": "{QuoteId}",
            "Comments": "Frontend probe {timestamp}"
          },
          "expected_status": 200
        }
      ]
    },
    {
      "id": "FE-LKP-001",
      "name": "Product lookup search",
      "mutates_data": false,
      "description": "Mirrors SearchableLookup searching Product2 through the SOSL-backed search endpoint.",
      "frontend_sources": [
        "frontend/src/components/form/SearchableLookup.tsx",
        "frontend/src/infrastructure/api/data/search.ts"
      ],
      "variables": {
        "ProductSearchTerm": "TiDB"
      },
      "steps": [
        {
          "name": "Search Product2 via the frontend SOSL search endpoint",
          "method": "GET",
          "endpoint": "/services/data/v63.0/search?q=FIND+%7B{url:ProductSearchTerm}%7D+IN+ALL+FIELDS+RETURNING+Product2(Id,+Name)",
          "expected_status": 200,
          "extract": {
            "ProductSearchCount": "searchRecords.length"
          }
        }
      ]
    }
  ]
}
