{
  "jira_key": "AN-95",
  "summary": "Account Priority Metrics",
  "approach": "1. Overview: Add an Account Lightning Web Component that shows priority metrics only when AnnualRevenue is greater than $10,000,000.\n2. Scope: Component rendering, server-side metric retrieval, an Account Tier text field, tests, and a permission set. Production deployment, merge, sharing/OWD redesign, and destructive deletes are excluded.\n3. Data Model: Add Account_Tier__c as a manually maintained text field. No tier values or classification rules are defined, so the design does not invent them.\n4. Picklist Configuration: None.\n5. Page Layout Configuration: The component can enforce the revenue threshold itself. Adding it to an Account Lightning Record Page requires FlexiPage metadata, which is outside the v1 allowlist and must be escalated.\n6. Validation Rule: None.\n7. Processing Behavior: The component calls an Apex controller using the Account record ID. The controller checks AnnualRevenue, then returns the Account Tier, the sum of Amount for Closed Won Opportunities, and the count of Cases where IsClosed is false. It returns no metrics for ineligible Accounts. Open Cases are treated as active; confirm this interpretation if the business uses a different definition.\n8. Security and Access: Use a with-sharing controller and user-mode queries so record sharing and object/field permissions are enforced. The permission set grants the required read access and Apex class access; it must be assigned through the approved access process. Query failures should surface to the component rather than silently showing success.\n9. Deployment Components: Account field, Apex controller and test, LWC bundle, and permission set. No trigger or Flow is required.\n10. Testing Strategy: Test above-, equal-to-, and below-threshold Accounts; Closed Won sums; open versus closed Case counts; Account Tier display; permission/query failure behavior; and component rendering on Account records.\n11. Acceptance Criteria Traceability: Threshold logic satisfies appearance only above $10,000,000; aggregate queries provide the requested Opportunity and Case metrics; the Account-page component presents these metrics together to reduce field scrolling. Page placement remains dependent on the escalated FlexiPage change.\n12. Implementation Summary: Implement the allowlisted components and verify the target org does not already contain Account_Tier__c before creating it. Obtain approval and an authorized deployment path for the Account Lightning Record Page placement.",
  "metadata_plan": [
    {
      "metadata_type": "CustomField",
      "api_name": "Account.Account_Tier__c",
      "action": "create",
      "object": "Account",
      "notes": "Data type: Text (255). Field label: Account Tier. Picklist values: not applicable. Default value: none. Required-at-definition: false. Manually maintained; no tier values or classification rules were specified. Confirm the target org does not already have this field before deployment."
    },
    {
      "metadata_type": "ApexClass",
      "api_name": "AccountPriorityMetricsController",
      "action": "create",
      "object": "Account",
      "notes": "with sharing controller; use user-mode access for Account, Opportunity, and Case reads. Check AnnualRevenue > 10000000 before returning metrics. Return the sum of Opportunity Amount where IsWon = true, count Cases where IsClosed = false, and Account_Tier__c. Surface query/access failures to the caller."
    },
    {
      "metadata_type": "ApexClass",
      "api_name": "AccountPriorityMetricsControllerTest",
      "action": "create",
      "object": "Account",
      "notes": "Test class for threshold eligibility, Closed Won Amount aggregation, open Case count, Account Tier, and ineligible Accounts. Include equality-at-threshold and below-threshold cases."
    },
    {
      "metadata_type": "LightningComponentBundle",
      "api_name": "accountPriorityMetrics",
      "action": "create",
      "object": "Account",
      "notes": "LWC folder uses camelCase. Accept recordId, call AccountPriorityMetricsController, and render the metrics only when the controller reports AnnualRevenue > 10000000. Include loading and visible error states. Requires placement on an Account Lightning Record Page; FlexiPage metadata is outside the v1 allowlist."
    },
    {
      "metadata_type": "PermissionSet",
      "api_name": "AccountPriorityMetricsAccess",
      "action": "create",
      "object": "Account",
      "notes": "Grant Apex class access to AccountPriorityMetricsController and read access to Account AnnualRevenue and Account_Tier__c, Opportunity Amount and IsWon, and Case IsClosed. Assign through the approved access process; this metadata does not itself assign the permission set."
    }
  ],
  "dependencies": [
    "Existing AccountHealthService.cls was reviewed; the provided implementation reports a health status and shows no apparent interaction with these metrics.",
    "The repository inventory reports six Apex classes but does not expose Account triggers or record-triggered Flows. Verify target-org automation and permissions before implementation/deployment.",
    "No existing GitHub code or open pull requests/branches for AN-95 were provided.",
    "Uses standard Account AnnualRevenue, Opportunity Amount and IsWon, and Case IsClosed fields."
  ],
  "risks_or_escalations": [
    "Escalate Account Lightning Record Page placement: the required FlexiPage metadata type is not in the v1 allowlist. The LWC can enforce its own threshold but cannot be placed on the page through the allowed metadata types.",
    "Confirm that IsClosed = false matches the business meaning of an active open Case.",
    "Account Tier has no defined values or assignment rules. The design uses a manually maintained text field and does not implement classification logic.",
    "The repository inventory may not reflect all target-org metadata. Verify Account_Tier__c and existing automation before creating or deploying components."
  ],
  "out_of_allowlist": true,
  "confidence": 0.85,
  "notes": "No production deployment, merge, sharing/OWD redesign, or destructive deletes are included."
}