{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/bitnob/json-schema/bitnob-public-policy-response-schema.json",
  "title": "PublicPolicyResponse",
  "x-generated": "2026-11-16",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/bitnob-swagger-openapi.yml#/components/schemas/PublicPolicyResponse",
  "properties": {
    "category": {
      "description": "Policy category controlling how it is evaluated: access, whitelist, limits, approvals, velocity, compliance, or quorum.",
      "type": "string"
    },
    "created_at": {
      "description": "Timestamp when the policy was created.",
      "format": "date-time",
      "type": "string"
    },
    "created_by": {
      "description": "Identifier of the user who created the policy.",
      "type": "string"
    },
    "created_by_name": {
      "description": "Display name of the user who created the policy.",
      "type": "string"
    },
    "description": {
      "description": "Optional free-text summary of the policy's intent.",
      "type": "string"
    },
    "id": {
      "description": "Unique identifier of the policy.",
      "type": "string"
    },
    "is_active": {
      "deprecated": true,
      "description": "Deprecated: derived from status (true when status is \"enforced\"). Read status instead.",
      "type": "boolean"
    },
    "is_template": {
      "description": "Whether this policy is a reusable template.",
      "type": "boolean"
    },
    "name": {
      "description": "Human-readable name of the policy.",
      "type": "string"
    },
    "object": {
      "description": "Object type discriminator; always \"policy\".",
      "type": "string"
    },
    "priority": {
      "description": "Evaluation priority of the policy relative to other policies.",
      "type": "integer"
    },
    "rule_count": {
      "description": "Number of rules contained in the policy.",
      "type": "integer"
    },
    "rules": {
      "description": "The policy's rules, when expanded.",
      "items": {
        "$ref": "#/$defs/PublicRuleResponse"
      },
      "type": "array"
    },
    "status": {
      "description": "Canonical lifecycle status: draft, enforced, or archived.",
      "type": "string"
    },
    "template_id": {
      "description": "Identifier of the template this policy was created from, if any.",
      "type": "string"
    },
    "updated_at": {
      "description": "Timestamp when the policy was last updated.",
      "format": "date-time",
      "type": "string"
    }
  },
  "type": "object",
  "$defs": {
    "PublicConditionResponse": {
      "properties": {
        "field": {
          "description": "The request attribute the condition compares against.",
          "type": "string"
        },
        "max": {
          "description": "Range upper bound for between/not_between operators."
        },
        "min": {
          "description": "Range lower bound for between/not_between operators."
        },
        "operator": {
          "description": "Comparison operator applied to the field.",
          "type": "string"
        },
        "value": {
          "description": "Scalar comparison value for single-operand operators."
        },
        "values": {
          "description": "Set of allowed (or disallowed) values for in/not_in operators.",
          "items": {},
          "type": "array"
        }
      },
      "type": "object"
    },
    "PublicRuleResponse": {
      "properties": {
        "action_config": {
          "description": "Type-specific configuration for the action; shape depends on action_type."
        },
        "action_type": {
          "description": "Action taken when the rule matches: allow, block, require_approval, alert, or delay.",
          "type": "string"
        },
        "conditions": {
          "description": "Conditions that must all match for the rule to apply.",
          "items": {
            "$ref": "#/$defs/PublicConditionResponse"
          },
          "type": "array"
        },
        "created_at": {
          "description": "Timestamp when the rule was created.",
          "format": "date-time",
          "type": "string"
        },
        "description": {
          "description": "Optional free-text summary of the rule's intent.",
          "type": "string"
        },
        "id": {
          "description": "Unique identifier of the rule.",
          "type": "string"
        },
        "name": {
          "description": "Human-readable name of the rule.",
          "type": "string"
        },
        "object": {
          "description": "Object type discriminator; always \"rule\".",
          "type": "string"
        },
        "order": {
          "description": "Position of the rule in the policy's first-match-wins evaluation order.",
          "type": "integer"
        },
        "priority": {
          "description": "Evaluation priority of the rule.",
          "type": "integer"
        },
        "updated_at": {
          "description": "Timestamp when the rule was last updated.",
          "format": "date-time",
          "type": "string"
        }
      },
      "type": "object"
    }
  }
}