{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/wordlift-io/json-schema/wordlift-io-rule-schema.json",
  "title": "Rule",
  "x-generated": "2026-11-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/wordlift-io-content-generation.yml#/components/schemas/Rule",
  "type": "object",
  "properties": {
    "created_at": {
      "type": "string",
      "format": "date-time",
      "description": "The create date-time.",
      "readOnly": true
    },
    "description": {
      "type": "string",
      "description": "Description for the rule"
    },
    "fixes": {
      "type": "array",
      "description": "The list of fixes to apply when the rule validation fails.",
      "items": {
        "$ref": "#/$defs/ValidationFix"
      }
    },
    "id": {
      "type": "integer",
      "format": "int64"
    },
    "is_enabled": {
      "type": "boolean"
    },
    "level": {
      "$ref": "#/$defs/LevelEnum"
    },
    "modified_at": {
      "type": "string",
      "format": "date-time",
      "description": "The last modified date-time.",
      "readOnly": true
    },
    "name": {
      "type": "string",
      "description": "The rule name."
    },
    "project_id": {
      "type": "integer",
      "format": "int64"
    },
    "project_type": {
      "$ref": "#/$defs/ProjectType"
    },
    "scope": {
      "$ref": "#/$defs/Scope"
    },
    "type": {
      "type": "string",
      "description": "The rule type, one of `field`, `word` or `code`. By default `field`."
    },
    "what_operand_lhs": {
      "$ref": "#/$defs/WhatOperandLhs"
    },
    "what_operand_rhs": {
      "type": "string",
      "description": "The right hand side operand for what condition."
    },
    "what_operator": {
      "$ref": "#/$defs/WhatOperator"
    },
    "when_operand_lhs": {
      "type": "string",
      "description": "The left hand side  operand for when condition."
    },
    "when_operand_rhs": {
      "type": "string",
      "description": "The right hand side operand for when condition."
    },
    "when_operator": {
      "$ref": "#/$defs/WhenOperator"
    }
  },
  "required": [
    "level",
    "name",
    "scope",
    "type",
    "what_operand_lhs",
    "what_operand_rhs",
    "what_operator",
    "when_operand_lhs",
    "when_operand_rhs",
    "when_operator"
  ],
  "$defs": {
    "LevelEnum": {
      "type": "string",
      "description": "The rule level.",
      "enum": [
        "RECOMMENDED",
        "REQUIRED"
      ]
    },
    "ProjectType": {
      "type": "string",
      "description": "The project type, if applicable.",
      "enum": [
        "SMART_CONTENT",
        "CONTENT_GENERATION"
      ]
    },
    "Scope": {
      "type": "string",
      "description": "The rule scope.",
      "enum": [
        "USER",
        "PROJECT"
      ]
    },
    "ValidationFix": {
      "type": "object",
      "description": "The list of fixes to apply when the rule validation fails.",
      "properties": {
        "type": {
          "$ref": "#/$defs/ValidationTypeEnum"
        },
        "what": {
          "type": "string"
        },
        "with": {
          "type": "string"
        }
      }
    },
    "ValidationTypeEnum": {
      "type": "string",
      "enum": [
        "FIND_AND_REPLACE",
        "OPEN_AI",
        "APPEND"
      ]
    },
    "WhatOperandLhs": {
      "type": "string",
      "description": "The left hand side operand for what condition.",
      "enum": [
        "EVERYWHERE",
        "FIRST_SENTENCE",
        "LAST_SENTENCE"
      ]
    },
    "WhatOperator": {
      "type": "string",
      "description": "The operator for what condition.",
      "enum": [
        "CONTAINS",
        "DOESNT_CONTAIN",
        "ENDS_WITH",
        "REGEX",
        "REGEX_DOESNT_MATCH"
      ]
    },
    "WhenOperator": {
      "type": "string",
      "description": "The operator for when condition.",
      "enum": [
        "ALWAYS",
        "EQUALS",
        "NOT_EQUALS"
      ]
    }
  }
}