{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/monacloud/main/json-schema/monacloud-job-response-schema.json",
  "title": "JobResponse",
  "x-generated": "2026-10-18",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/monacloud-vn-openapi.json#/components/schemas/JobResponse",
  "properties": {
    "id": {
      "type": "string",
      "title": "Id"
    },
    "status": {
      "type": "string",
      "enum": [
        "queued",
        "pending",
        "running",
        "done",
        "succeeded",
        "failed",
        "retrying",
        "cancelled"
      ],
      "title": "Status"
    },
    "type": {
      "type": "string",
      "title": "Type"
    },
    "result": {
      "anyOf": [
        {
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Result"
    },
    "error": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Error"
    },
    "attempts": {
      "type": "integer",
      "title": "Attempts",
      "default": 0
    },
    "max_attempts": {
      "type": "integer",
      "title": "Max Attempts",
      "default": 0
    },
    "stages": {
      "items": {
        "$ref": "#/$defs/JobStage"
      },
      "type": "array",
      "title": "Stages"
    },
    "created_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Created At"
    },
    "updated_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Updated At"
    },
    "sandbox": {
      "type": "boolean",
      "title": "Sandbox",
      "default": false
    },
    "expires_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Expires At"
    }
  },
  "type": "object",
  "required": [
    "id",
    "status",
    "type"
  ],
  "$defs": {
    "JobStage": {
      "properties": {
        "name": {
          "type": "string",
          "title": "Name"
        },
        "status": {
          "type": "string",
          "enum": [
            "running",
            "succeeded",
            "failed"
          ],
          "title": "Status"
        },
        "started_at": {
          "type": "string",
          "format": "date-time",
          "title": "Started At"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time",
          "title": "Updated At"
        },
        "completed_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Completed At"
        },
        "duration_seconds": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Duration Seconds"
        },
        "error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Error"
        },
        "detail": {
          "anyOf": [
            {
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Detail"
        }
      },
      "type": "object",
      "required": [
        "name",
        "status",
        "started_at",
        "updated_at"
      ],
      "title": "JobStage"
    }
  }
}