{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://weverlabs.com/schemas/runtime-table-access-policy.schema.json",
  "title": "Wever Labs Runtime Table Access Policy",
  "type": "object",
  "required": [
    "table_name",
    "rls_enabled",
    "read_policy",
    "write_policy",
    "service_role_required"
  ],
  "properties": {
    "table_name": {
      "type": "string"
    },
    "rls_enabled": {
      "type": "boolean"
    },
    "read_policy": {
      "type": "string",
      "enum": [
        "public_discovery",
        "trusted_agent_scope",
        "client_task_scope",
        "operator_scope",
        "service_role_only",
        "no_public_read"
      ]
    },
    "write_policy": {
      "type": "string",
      "enum": [
        "service_role_only",
        "provider_webhook_function_only",
        "callback_function_only",
        "operator_function_only",
        "no_public_write"
      ]
    },
    "service_role_required": {
      "type": "boolean"
    },
    "scope_fields": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "audit_event_required": {
      "type": "boolean"
    }
  }
}