{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://jentic.com/schemas/jentic/operation.json",
  "title": "Jentic Operation",
  "description": "Represents an API operation or workflow in the Jentic catalog, including its metadata, input schema, and execution requirements.",
  "type": "object",
  "required": ["uuid", "name", "type"],
  "properties": {
    "uuid": {
      "type": "string",
      "description": "Unique identifier for the operation, prefixed with 'op_' for operations or 'wf_' for workflows.",
      "pattern": "^(op_|wf_).+"
    },
    "name": {
      "type": "string",
      "description": "Human-readable name of the operation or workflow.",
      "minLength": 1
    },
    "description": {
      "type": "string",
      "description": "Detailed description of what the operation or workflow does."
    },
    "type": {
      "type": "string",
      "description": "Whether this is a single API operation or a multi-step Arazzo workflow.",
      "enum": ["operation", "workflow"]
    },
    "api_name": {
      "type": "string",
      "description": "Name of the upstream API that provides this operation."
    },
    "method": {
      "type": "string",
      "description": "HTTP method for the operation, applicable to single operations.",
      "enum": ["GET", "POST", "PUT", "PATCH", "DELETE"]
    },
    "path": {
      "type": "string",
      "description": "URL path template for the operation."
    },
    "inputs": {
      "$ref": "#/$defs/InputSchema",
      "description": "JSON Schema describing the required and optional input parameters."
    },
    "auth_required": {
      "type": "boolean",
      "description": "Whether upstream API credentials must be configured in the Jentic credential vault.",
      "default": false
    },
    "tags": {
      "type": "array",
      "description": "Categorization tags for the operation.",
      "items": {
        "type": "string"
      }
    }
  },
  "$defs": {
    "InputSchema": {
      "type": "object",
      "description": "Schema describing the input parameters for an operation.",
      "properties": {
        "type": {
          "type": "string",
          "const": "object"
        },
        "required": {
          "type": "array",
          "description": "List of required input parameter names.",
          "items": {
            "type": "string"
          }
        },
        "properties": {
          "type": "object",
          "description": "Map of parameter names to their type definitions.",
          "additionalProperties": {
            "$ref": "#/$defs/InputParameter"
          }
        }
      }
    },
    "InputParameter": {
      "type": "object",
      "description": "Definition of a single input parameter for an operation.",
      "properties": {
        "type": {
          "type": "string",
          "description": "The data type of the parameter.",
          "enum": ["string", "integer", "number", "boolean", "array", "object"]
        },
        "description": {
          "type": "string",
          "description": "Human-readable description of the parameter."
        },
        "enum": {
          "type": "array",
          "description": "Allowed values for the parameter."
        },
        "default": {
          "description": "Default value for the parameter when not provided."
        },
        "format": {
          "type": "string",
          "description": "Format hint for the parameter value, such as 'email', 'uri', or 'date-time'."
        }
      }
    }
  }
}
