{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/beatra-ai/json-schema/beatra-ai-task-detail-schema.json",
  "title": "TaskDetail",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/beatra-ai-account-api-openapi.yml#/components/schemas/TaskDetail",
  "properties": {
    "task_id": {
      "type": "string",
      "title": "Task Id"
    },
    "capability": {
      "type": "string",
      "title": "Capability"
    },
    "workload_type": {
      "type": "string",
      "enum": [
        "model",
        "social_operation"
      ],
      "title": "Workload Type",
      "default": "model"
    },
    "model": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Model"
    },
    "resolved_model": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Resolved Model"
    },
    "social": {
      "anyOf": [
        {
          "$ref": "#/$defs/SocialTaskIdentity"
        },
        {
          "type": "null"
        }
      ]
    },
    "status": {
      "$ref": "#/$defs/TaskStatusEnum"
    },
    "phase": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Phase"
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "title": "Created At"
    },
    "started_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Started At"
    },
    "completed_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Completed At"
    },
    "cancel_requested_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Cancel Requested At"
    },
    "progress": {
      "anyOf": [
        {
          "$ref": "#/$defs/app__api__account__schemas__TaskProgress"
        },
        {
          "type": "null"
        }
      ]
    },
    "error": {
      "anyOf": [
        {
          "$ref": "#/$defs/app__api__account__schemas__TaskError"
        },
        {
          "type": "null"
        }
      ]
    },
    "request_parameters": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Request Parameters",
      "description": "Provider-neutral request parameters after recursive public projection."
    },
    "output_summary": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Output Summary",
      "description": "Provider-neutral task output after recursive supply declassification."
    },
    "billing": {
      "$ref": "#/$defs/TaskBillingSummary"
    },
    "callback": {
      "anyOf": [
        {
          "$ref": "#/$defs/TaskCallbackSummary"
        },
        {
          "type": "null"
        }
      ]
    },
    "operation": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "clone",
            "activate"
          ]
        },
        {
          "type": "null"
        }
      ],
      "title": "Operation"
    }
  },
  "type": "object",
  "required": [
    "task_id",
    "capability",
    "status",
    "created_at",
    "billing"
  ],
  "$defs": {
    "CallbackStatusEnum": {
      "type": "string",
      "enum": [
        "pending",
        "dispatching",
        "delivered",
        "retrying",
        "failed"
      ],
      "title": "CallbackStatusEnum"
    },
    "SocialTaskIdentity": {
      "properties": {
        "platform": {
          "type": "string",
          "title": "Platform"
        },
        "operation_key": {
          "type": "string",
          "title": "Operation Key"
        },
        "operation_name": {
          "type": "string",
          "title": "Operation Name"
        },
        "schema_hash": {
          "type": "string",
          "title": "Schema Hash"
        }
      },
      "type": "object",
      "required": [
        "platform",
        "operation_key",
        "operation_name",
        "schema_hash"
      ],
      "title": "SocialTaskIdentity"
    },
    "TaskBillingSummary": {
      "properties": {
        "billing_mode": {
          "type": "string",
          "title": "Billing Mode"
        },
        "charge_status": {
          "type": "string",
          "title": "Charge Status"
        },
        "refund_status": {
          "type": "string",
          "title": "Refund Status"
        },
        "charged_credits": {
          "type": "string",
          "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
          "title": "Charged Credits"
        },
        "refunded_credits": {
          "type": "string",
          "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
          "title": "Refunded Credits"
        },
        "granted_credits": {
          "anyOf": [
            {
              "type": "string",
              "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
            },
            {
              "type": "null"
            }
          ],
          "title": "Granted Credits"
        },
        "grant_source": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Grant Source"
        }
      },
      "type": "object",
      "required": [
        "billing_mode",
        "charge_status",
        "refund_status",
        "charged_credits",
        "refunded_credits"
      ],
      "title": "TaskBillingSummary"
    },
    "TaskCallbackSummary": {
      "properties": {
        "url": {
          "type": "string",
          "title": "Url"
        },
        "status": {
          "$ref": "#/$defs/CallbackStatusEnum"
        },
        "attempt_count": {
          "type": "integer",
          "title": "Attempt Count"
        },
        "last_status_code": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Last Status Code"
        },
        "last_error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Last Error"
        },
        "next_action_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Next Action At"
        },
        "delivered_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Delivered At"
        }
      },
      "type": "object",
      "required": [
        "url",
        "status",
        "attempt_count"
      ],
      "title": "TaskCallbackSummary"
    },
    "TaskStatusEnum": {
      "type": "string",
      "enum": [
        "queued",
        "running",
        "succeeded",
        "failed",
        "canceled"
      ],
      "title": "TaskStatusEnum"
    },
    "app__api__account__schemas__TaskError": {
      "properties": {
        "code": {
          "type": "string",
          "title": "Code"
        },
        "data": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Data",
          "description": "Provider-neutral failure details after recursive supply declassification."
        }
      },
      "type": "object",
      "required": [
        "code"
      ],
      "title": "TaskError"
    },
    "app__api__account__schemas__TaskProgress": {
      "properties": {
        "percent": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Percent"
        },
        "stage": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Stage"
        },
        "message": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Message"
        }
      },
      "type": "object",
      "title": "TaskProgress"
    }
  }
}