[
  {
    "apiName": "CaseComment",
    "keyPrefix": "00a",
    "label": "Case Comment",
    "tableType": "standard_object",
    "category": "crm",
    "sharingModel": "ControlledByParent",
    "enableHierarchySharing": false,
    "description": "Standard Salesforce CaseComment object; record-level visibility follows the parent Case while object and field access are delegated through metadata-authored access policy.",
    "accessPolicy": {
      "mode": "derived",
      "objectRead": {
        "kind": "objectPermission",
        "object": "Case",
        "operation": "Read"
      },
      "objectCreate": {
        "kind": "objectPermission",
        "object": "Case",
        "operation": "Edit"
      },
      "objectEdit": {
        "allOf": [
          {
            "kind": "objectPermission",
            "object": "Case",
            "operation": "Edit"
          },
          {
            "anyOf": [
              {
                "kind": "objectPermission",
                "object": "Case",
                "operation": "ModifyAllRecords"
              },
              {
                "allOf": [
                  {
                    "kind": "systemPermission",
                    "apiName": "EditCaseComments"
                  },
                  {
                    "kind": "recordFieldEqualsCurrentUser",
                    "field": "CreatedById"
                  }
                ]
              }
            ]
          }
        ]
      },
      "objectDelete": {
        "allOf": [
          {
            "kind": "objectPermission",
            "object": "Case",
            "operation": "Edit"
          },
          {
            "anyOf": [
              {
                "kind": "objectPermission",
                "object": "Case",
                "operation": "ModifyAllRecords"
              },
              {
                "allOf": [
                  {
                    "kind": "systemPermission",
                    "apiName": "EditCaseComments"
                  },
                  {
                    "kind": "recordFieldEqualsCurrentUser",
                    "field": "CreatedById"
                  }
                ]
              }
            ]
          }
        ]
      },
      "fieldRead": {
        "inherit": "objectRead"
      },
      "fieldEdit": {
        "inherit": "objectEdit"
      }
    },
    "fields": [
      {
        "apiName": "ParentId",
        "label": "Case",
        "type": "reference",
        "required": true,
        "referenceTo": [
          "Case"
        ],
        "relationshipName": "Parent",
        "childRelationshipName": "CaseComments"
      },
      {
        "apiName": "CommentBody",
        "label": "Comment Body",
        "type": "textarea",
        "required": false
      },
      {
        "apiName": "IsPublished",
        "label": "Published",
        "type": "boolean",
        "required": true,
        "default": "0"
      },
      {
        "apiName": "ParentOrigin",
        "type": "picklist",
        "label": "ParentOrigin",
        "options": [
          {
            "value": "Phone",
            "label": "Phone"
          },
          {
            "value": "Email",
            "label": "Email"
          },
          {
            "value": "Web",
            "label": "Web"
          }
        ]
      }
    ],
    "managedRelationships": [
      {
        "fieldApiName": "ParentId",
        "parentObject": "Case",
        "isSharingParent": true
      }
    ]
  }
]
