{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/flowspeech/json-schema/flowspeech-job-schema.json",
  "title": "Job",
  "x-generated": "2026-11-08",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/flowspeech-openapi.json#/components/schemas/Job",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "requestId": {
      "type": "string",
      "format": "uuid"
    },
    "model": {
      "const": "gemini-tts"
    },
    "status": {
      "type": "string",
      "enum": [
        "queued",
        "running",
        "merging",
        "settling",
        "success",
        "failed",
        "cancelled"
      ]
    },
    "progress": {
      "type": "object",
      "properties": {
        "completed": {
          "type": "integer",
          "minimum": 0
        },
        "total": {
          "type": "integer",
          "minimum": 0
        }
      },
      "required": [
        "completed",
        "total"
      ]
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "deadlineAt": {
      "type": "string",
      "format": "date-time"
    },
    "usage": {
      "$ref": "#/$defs/Usage"
    },
    "quota": {
      "$ref": "#/$defs/Quota"
    },
    "error": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string"
        }
      },
      "required": [
        "code"
      ]
    },
    "resultDeleted": {
      "type": "boolean"
    },
    "result": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "type": "object",
          "properties": {
            "url": {
              "type": "string",
              "format": "uri"
            },
            "mimeType": {
              "const": "audio/wav"
            },
            "sampleRate": {
              "const": 24000
            },
            "channels": {
              "const": 1
            },
            "bitsPerSample": {
              "const": 16
            },
            "access": {
              "const": "link"
            }
          },
          "required": [
            "url",
            "mimeType",
            "sampleRate",
            "channels",
            "bitsPerSample",
            "access"
          ]
        }
      ]
    }
  },
  "required": [
    "id",
    "requestId",
    "model",
    "status",
    "progress",
    "createdAt",
    "updatedAt",
    "deadlineAt",
    "usage"
  ],
  "$defs": {
    "Quota": {
      "type": "object",
      "properties": {
        "total": {
          "type": "integer",
          "minimum": 0
        },
        "remaining": {
          "type": "integer",
          "minimum": 0
        },
        "reserved": {
          "type": "integer",
          "minimum": 0
        },
        "available": {
          "type": "integer",
          "minimum": 0
        },
        "nextResetAt": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "total",
        "remaining",
        "reserved",
        "available"
      ]
    },
    "Usage": {
      "type": "object",
      "properties": {
        "billableCharacters": {
          "type": "integer",
          "minimum": 0
        },
        "reservedCredits": {
          "type": "integer",
          "minimum": 0
        },
        "chargedCredits": {
          "type": "integer",
          "minimum": 0
        }
      },
      "required": [
        "billableCharacters",
        "reservedCredits",
        "chargedCredits"
      ]
    }
  }
}