{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/bookmyhost/json-schema/bookmyhost-policy-dbresponse-schema.json",
  "title": "PolicyDBResponse",
  "description": "Response for a policy from the database.",
  "x-generated": "2026-11-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/bookmyhost-policy-engine-api-openapi.yml#/components/schemas/PolicyDBResponse",
  "properties": {
    "condition": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "description": "Policy condition.",
      "title": "Condition"
    },
    "created_at": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "When the policy was created.",
      "title": "Created At"
    },
    "created_by": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "Who created the policy.",
      "title": "Created By"
    },
    "description": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "Policy description.",
      "title": "Description"
    },
    "guardrails_add": {
      "description": "Guardrails to add.",
      "items": {
        "type": "string"
      },
      "title": "Guardrails Add",
      "type": "array"
    },
    "guardrails_remove": {
      "description": "Guardrails to remove.",
      "items": {
        "type": "string"
      },
      "title": "Guardrails Remove",
      "type": "array"
    },
    "inherit": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "Parent policy name.",
      "title": "Inherit"
    },
    "is_latest": {
      "default": true,
      "description": "True if this is the latest version by version_number.",
      "title": "Is Latest",
      "type": "boolean"
    },
    "parent_version_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "Policy ID this version was cloned from.",
      "title": "Parent Version Id"
    },
    "pipeline": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "description": "Optional guardrail pipeline.",
      "title": "Pipeline"
    },
    "policy_id": {
      "description": "Unique ID of the policy.",
      "title": "Policy Id",
      "type": "string"
    },
    "policy_name": {
      "description": "Name of the policy.",
      "title": "Policy Name",
      "type": "string"
    },
    "production_at": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "When this version was promoted to production.",
      "title": "Production At"
    },
    "published_at": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "When this version was published.",
      "title": "Published At"
    },
    "updated_at": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "When the policy was last updated.",
      "title": "Updated At"
    },
    "updated_by": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "Who last updated the policy.",
      "title": "Updated By"
    },
    "version_number": {
      "default": 1,
      "description": "Version number of this policy.",
      "title": "Version Number",
      "type": "integer"
    },
    "version_status": {
      "default": "production",
      "description": "One of: draft, published, production.",
      "title": "Version Status",
      "type": "string"
    }
  },
  "required": [
    "policy_id",
    "policy_name"
  ],
  "type": "object"
}