{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/api-gouv-fr/json-schema/api-gouv-fr-harvest-job-page-schema.json",
  "title": "HarvestJobPage",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/api-gouv-fr-harvest-api-openapi.yml#/components/schemas/HarvestJobPage",
  "properties": {
    "data": {
      "description": "The page data",
      "items": {
        "$ref": "#/$defs/HarvestJob__read"
      },
      "type": "array"
    },
    "next_page": {
      "description": "The next page URL if exists",
      "type": "string"
    },
    "page": {
      "description": "The current page",
      "minimum": 1,
      "type": "integer"
    },
    "page_size": {
      "description": "The page size used for pagination",
      "minimum": 0,
      "type": "integer"
    },
    "previous_page": {
      "description": "The previous page URL if exists",
      "type": "string"
    },
    "total": {
      "description": "The total paginated items",
      "minimum": 0,
      "type": "integer"
    }
  },
  "required": [
    "page",
    "page_size",
    "total"
  ],
  "type": "object",
  "$defs": {
    "BaseReference": {
      "properties": {
        "class": {
          "description": "The object class",
          "type": "string"
        },
        "id": {
          "description": "The object unique identifier",
          "type": "string"
        }
      },
      "required": [
        "class",
        "id"
      ],
      "type": "object"
    },
    "HarvestError__read": {
      "properties": {
        "created_at": {
          "description": "The error creation date",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "details": {
          "description": "Optional details (only for super-admins)",
          "readOnly": true,
          "type": "string"
        },
        "message": {
          "description": "The error short message",
          "type": "string"
        }
      },
      "required": [
        "created_at"
      ],
      "type": "object"
    },
    "HarvestJob__read": {
      "properties": {
        "created": {
          "description": "The job creation date",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "ended": {
          "description": "The job end date",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "errors": {
          "description": "The job initialization errors",
          "items": {
            "allOf": [
              {
                "$ref": "#/$defs/HarvestError__read"
              }
            ],
            "description": "The job initialization errors",
            "readOnly": true
          },
          "readOnly": true,
          "type": "array"
        },
        "id": {
          "readOnly": true,
          "type": "string"
        },
        "items": {
          "description": "Visit this API link to see the list.",
          "readOnly": true,
          "type": "object"
        },
        "source": {
          "allOf": [
            {
              "$ref": "#/$defs/HarvestSourceReference"
            }
          ],
          "description": "The source owning the job",
          "readOnly": true
        },
        "started": {
          "description": "The job start date",
          "format": "date-time",
          "readOnly": true,
          "type": "string"
        },
        "status": {
          "description": "The job status",
          "enum": [
            "pending",
            "initializing",
            "initialized",
            "processing",
            "done",
            "done-errors",
            "failed"
          ],
          "readOnly": true,
          "type": "string"
        }
      },
      "required": [
        "created",
        "id",
        "status"
      ],
      "type": "object"
    },
    "HarvestSourceReference": {
      "allOf": [
        {
          "$ref": "#/$defs/BaseReference"
        },
        {
          "properties": {},
          "type": "object"
        }
      ]
    }
  }
}