{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/modoboa/json-schema/modoboa-paginated-thread-list-schema.json",
  "title": "PaginatedThreadList",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/modoboa-webmail-api-openapi.yml#/components/schemas/PaginatedThreadList",
  "type": "object",
  "properties": {
    "count": {
      "type": "integer"
    },
    "first_index": {
      "type": "integer"
    },
    "last_index": {
      "type": "integer"
    },
    "prev_page": {
      "type": "integer"
    },
    "next_page": {
      "type": "integer"
    },
    "threading_supported": {
      "type": "boolean"
    },
    "state": {
      "type": [
        "string",
        "null"
      ]
    },
    "unseen": {
      "type": [
        "integer",
        "null"
      ]
    },
    "results": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ThreadSummary"
      }
    }
  },
  "required": [
    "count",
    "first_index",
    "last_index",
    "next_page",
    "prev_page",
    "results",
    "state",
    "threading_supported",
    "unseen"
  ],
  "$defs": {
    "Attachment": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "partnum": {
          "type": "string"
        },
        "size": {
          "type": "integer"
        },
        "content_type": {
          "type": "string"
        }
      },
      "required": [
        "name",
        "partnum"
      ]
    },
    "EmailAddress": {
      "type": "object",
      "description": "Email address serializer.",
      "properties": {
        "pk": {
          "type": "integer",
          "readOnly": true,
          "title": "ID"
        },
        "address": {
          "type": "string",
          "format": "email",
          "maxLength": 254
        },
        "type": {
          "$ref": "#/$defs/TypeE1dEnum"
        }
      },
      "required": [
        "address",
        "pk",
        "type"
      ]
    },
    "EmailHeaders": {
      "type": "object",
      "properties": {
        "imapid": {
          "type": "string"
        },
        "subject": {
          "type": "string",
          "readOnly": true
        },
        "from_address": {
          "type": "string",
          "readOnly": true
        },
        "recipients": {
          "type": "string",
          "readOnly": true
        },
        "date": {
          "type": "string",
          "readOnly": true
        },
        "size": {
          "type": "integer"
        },
        "answered": {
          "type": "boolean",
          "default": false
        },
        "attachments": {
          "type": "boolean",
          "default": false
        },
        "forwarded": {
          "type": "boolean",
          "default": false
        },
        "flagged": {
          "type": "boolean",
          "default": false
        },
        "attachment_list": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Attachment"
          }
        },
        "style": {
          "type": "string"
        },
        "scheduled_id": {
          "type": "integer"
        },
        "scheduled_datetime": {
          "type": "string",
          "readOnly": true
        },
        "scheduled_datetime_raw": {
          "type": "string"
        }
      },
      "required": [
        "date",
        "from_address",
        "imapid",
        "recipients",
        "scheduled_datetime",
        "size",
        "subject"
      ]
    },
    "ThreadSummary": {
      "type": "object",
      "description": "A conversation, as displayed in the messages list.",
      "properties": {
        "root": {
          "type": "string"
        },
        "latest": {
          "$ref": "#/$defs/EmailHeaders"
        },
        "subject": {
          "type": "string",
          "readOnly": true
        },
        "count": {
          "type": "integer"
        },
        "unseen_count": {
          "type": "integer"
        },
        "flagged": {
          "type": "boolean",
          "default": false
        },
        "attachments": {
          "type": "boolean",
          "default": false
        },
        "participants": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/EmailAddress"
          }
        },
        "uids": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "count",
        "latest",
        "participants",
        "root",
        "subject",
        "uids",
        "unseen_count"
      ]
    },
    "TypeE1dEnum": {
      "enum": [
        "home",
        "work",
        "other"
      ],
      "type": "string",
      "description": "* `home` - Home\n* `work` - Work\n* `other` - Other"
    }
  }
}