{
  "jira_key": "AN-40",
  "summary": "Account Customer Tier Automation",
  "approach": "Implement a non-editable Customer Tier picklist field on Account, automatically set via a record-triggered Flow based on Annual Revenue. Field is displayed on the Lightning Record Page. Backfill existing Accounts using the same Flow logic. All configuration uses allowlisted metadata only.",
  "metadata_plan": [
    {
      "metadata_type": "CustomField",
      "api_name": "Customer_Tier__c",
      "action": "create",
      "object": "Account",
      "notes": "Data type: Picklist. Field label: Customer Tier. Picklist values: Platinum, Gold, Silver, Bronze (per mapping). Default value: (none). Required-at-definition: false. Field-level security: not editable by users."
    },
    {
      "metadata_type": "Flow",
      "api_name": "Set_Account_Customer_Tier",
      "action": "create",
      "object": "Account",
      "notes": "Record-triggered Flow on Account. Trigger: when record is created or AnnualRevenue changes. Logic: set Customer_Tier__c according to revenue mapping. Also supports backfill via scheduled path or manual launch."
    },
    {
      "metadata_type": "ValidationRule",
      "api_name": "Prevent_Manual_Customer_Tier_Edit",
      "action": "create",
      "object": "Account",
      "notes": "Purpose: Prevent manual edits to Customer Tier. Formula: ISCHANGED(Customer_Tier__c) && NOT(ISCHANGED(AnnualRevenue)). Error message: 'Customer Tier is set automatically and cannot be edited.' Error location: Customer_Tier__c field."
    },
    {
      "metadata_type": "LightningComponentBundle",
      "api_name": "accountSummary",
      "action": "update",
      "object": null,
      "notes": "Update Account Summary LWC to display Customer Tier if not already present."
    },
    {
      "metadata_type": "ApexClass",
      "api_name": "AccountService",
      "action": "update",
      "object": null,
      "notes": "If domain logic for Customer Tier assignment is centralized, update AccountService to expose tier calculation logic for reuse (optional, if Flow-only logic is insufficient)."
    },
    {
      "metadata_type": "PermissionSet",
      "api_name": "Account_Customer_Tier_Access",
      "action": "create",
      "object": null,
      "notes": "Grant read-only access to Customer_Tier__c for relevant users."
    }
  ],
  "dependencies": [
    "force-app/main/default/classes/AccountService.cls (if logic is reused)",
    "force-app/main/default/lwc/accountSummary/accountSummary.js"
  ],
  "risks_or_escalations": [
    "No escalation required. All planned metadata is within v1 allowlist."
  ],
  "out_of_allowlist": false,
  "confidence": 1.0,
  "notes": "All requirements are addressed using allowlisted metadata. No blockers or ambiguities remain. No out-of-scope metadata types are required."
}