{
    "swagger": "2.0",
    "info": {
        "description": "Job-submission API for Hades, a scalable scheduler for containerized jobs. Submit a multi-step job and it is validated, assigned a UUID, and queued on NATS by priority for the scheduler to execute.",
        "title": "HadesAPI",
        "contact": {},
        "version": "1.0"
    },
    "basePath": "/",
    "paths": {
        "/build": {
            "post": {
                "security": [
                    {
                        "BasicAuth": []
                    }
                ],
                "description": "Validates a multi-step job, assigns a UUID, and publishes it to NATS on the queue matching its priority. Requires HTTP Basic Auth when the server is started with an AUTH_KEY.",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "jobs"
                ],
                "summary": "Enqueue a build job",
                "parameters": [
                    {
                        "description": "Job definition",
                        "name": "payload",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/payload.RESTPayload"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "job_id of the enqueued job",
                        "schema": {
                            "type": "object",
                            "additionalProperties": {
                                "type": "string"
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid request payload",
                        "schema": {
                            "type": "string"
                        }
                    },
                    "500": {
                        "description": "Failed to enqueue job",
                        "schema": {
                            "type": "string"
                        }
                    }
                }
            }
        },
        "/ping": {
            "get": {
                "description": "Liveness probe returning a status string and the current server time.",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "health"
                ],
                "summary": "Health check",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "object",
                            "additionalProperties": {
                                "type": "string"
                            }
                        }
                    }
                }
            }
        }
    },
    "definitions": {
        "payload.RESTPayload": {
            "type": "object",
            "required": [
                "name"
            ],
            "properties": {
                "callback_url": {
                    "description": "Optional per-job destination for forwarding aggregated logs/results. Must be an absolute http/https URL with a host.",
                    "type": "string",
                    "format": "uri"
                },
                "id": {
                    "description": "Unique job identifier",
                    "type": "string"
                },
                "metadata": {
                    "description": "Additional job-level metadata",
                    "type": "object",
                    "additionalProperties": {
                        "type": "string"
                    }
                },
                "name": {
                    "description": "Human-readable job name",
                    "type": "string"
                },
                "priority": {
                    "description": "Priority level (1=low, 2=medium, 3+=high)",
                    "type": "integer"
                },
                "status_callback_url": {
                    "description": "Optional per-job destination for the job-status webhook, sent when the job reaches a terminal status. Independent of callback_url. Delivery is at-least-once: a retry can repeat a notification, so receivers must deduplicate on job_id and handle it idempotently. Redirects are not followed. Must be an absolute http/https URL with a host.",
                    "type": "string",
                    "format": "uri"
                },
                "steps": {
                    "description": "Ordered list of steps to execute",
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/payload.Step"
                    }
                },
                "timeout_seconds": {
                    "description": "Whole-job timeout in seconds; the job is killed and marked failed once exceeded. 0 = no timeout.",
                    "type": "integer"
                },
                "timestamp": {
                    "description": "Job creation timestamp",
                    "type": "string"
                },
                "traceparent": {
                    "description": "W3C trace context propagated from the API so scheduler/operator spans nest under the job trace. Not injected into containers.",
                    "type": "string"
                }
            }
        },
        "payload.Step": {
            "type": "object",
            "properties": {
                "continue_on_error": {
                    "description": "Whether to continue with the next step if this step fails",
                    "type": "boolean"
                },
                "cpu_limit": {
                    "description": "CPU limit in whole cores (e.g., 1 = 1 CPU core, 2 = 2 cores)",
                    "type": "integer"
                },
                "id": {
                    "description": "Step execution order (starts at 1)",
                    "type": "integer"
                },
                "image": {
                    "description": "Container image to use (e.g., \"alpine:latest\")",
                    "type": "string"
                },
                "memory_limit": {
                    "description": "Memory limit (e.g., \"512M\", \"2G\")",
                    "type": "string"
                },
                "memory_swap": {
                    "description": "Total memory+swap limit, same format as memory_limit (e.g., \"512M\", \"2G\"); requires memory_limit to be set and must be \u003e= memory_limit. Docker executor only.",
                    "type": "string"
                },
                "metadata": {
                    "description": "Step-specific environment variables and metadata",
                    "type": "object",
                    "additionalProperties": {
                        "type": "string"
                    }
                },
                "name": {
                    "description": "Human-readable step name",
                    "type": "string"
                },
                "network": {
                    "description": "Docker network mode: \"none\", \"bridge\", \"host\", \"default\", or a named network. Empty = executor default. Docker executor only; accepted but not enforced on Kubernetes.",
                    "type": "string"
                },
                "pids_limit": {
                    "description": "Maximum number of PIDs in the container; 0 = unlimited. Docker executor only.",
                    "type": "integer"
                },
                "script": {
                    "description": "Shell script to execute in the container",
                    "type": "string"
                }
            }
        }
    },
    "securityDefinitions": {
        "BasicAuth": {
            "type": "basic"
        }
    }
}