{
    "openapi": "3.1.0",
    "info": {
        "title": "Region360 Municipality API",
        "version": "1.0.0",
        "description": "Versioned server-to-server API for municipal tools. Public read respects publication, confirmation and the 24-weekday-hour public visibility window. Public and internal permissions are separate. Create/revoke keys in the municipality portal; no anonymous access to these endpoints. Tokens expire after 90 days by default (maximum 365), and loss of creator permissions invalidates them. GET rate limit 120/min/key; writes 30/min/key. No report creation, deletion or uploads in v1. An additional per-IP limit of 240 requests/minute applies before token lookup."
    },
    "servers": [
        {
            "url": "/api/v1"
        }
    ],
    "paths": {
        "/municipalities/{municipality}/reports": {
            "get": {
                "operationId": "listReports",
                "summary": "List publicly visible reports",
                "description": "Requires public:read. API keys are bound to a municipality and a currently authorized, verified municipal manager.",
                "x-required-scopes": [
                    "public:read"
                ],
                "security": [
                    {
                        "municipalityKey": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ReportPage"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing, invalid, expired, revoked key or inactive creator authorization.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Scope, package or permission denied.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Municipality or report not available to this key.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Stale edit_version. Reload and review before retrying.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Invalid or unsupported input fields.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded. Observe Retry-After.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds until a retry is allowed.",
                                "schema": {
                                    "type": "integer"
                                }
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "municipality",
                        "in": "path",
                        "required": true,
                        "description": "The municipality slug bound to this API key.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "q",
                        "in": "query",
                        "description": "Search report titles or public codes.",
                        "schema": {
                            "type": "string",
                            "maxLength": 120
                        }
                    },
                    {
                        "name": "type",
                        "in": "query",
                        "description": "Filter report type.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "problem",
                                "idea"
                            ]
                        }
                    },
                    {
                        "name": "status",
                        "in": "query",
                        "description": "Filter the displayed common public status.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "open",
                                "progress",
                                "external",
                                "done"
                            ]
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "description": "Pagination page.",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "default": 1
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "description": "Maximum page size 100.",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "default": 25
                        }
                    },
                    {
                        "name": "visibility",
                        "in": "query",
                        "description": "internal additionally requires internal:read and the internal collaboration package (plan 3 or higher). It can include municipal nonpublic reports; no reporter contact details are returned.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "public",
                                "internal"
                            ],
                            "default": "public"
                        }
                    }
                ]
            }
        },
        "/municipalities/{municipality}/reports/{report}": {
            "get": {
                "operationId": "getReport",
                "summary": "Read one report",
                "description": "Requires public:read. API keys are bound to a municipality and a currently authorized, verified municipal manager.",
                "x-required-scopes": [
                    "public:read"
                ],
                "security": [
                    {
                        "municipalityKey": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ReportEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing, invalid, expired, revoked key or inactive creator authorization.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Scope, package or permission denied.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Municipality or report not available to this key.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Stale edit_version. Reload and review before retrying.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Invalid or unsupported input fields.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded. Observe Retry-After.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds until a retry is allowed.",
                                "schema": {
                                    "type": "integer"
                                }
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "municipality",
                        "in": "path",
                        "required": true,
                        "description": "The municipality slug bound to this API key.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "report",
                        "in": "path",
                        "required": true,
                        "description": "Public report code, not a numeric database ID.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "visibility",
                        "in": "query",
                        "description": "internal additionally requires internal:read and plan 3 or higher.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "public",
                                "internal"
                            ],
                            "default": "public"
                        }
                    }
                ]
            }
        },
        "/municipalities/{municipality}/reports/{report}/progress": {
            "patch": {
                "operationId": "updateProgress",
                "summary": "Publish a justified progress update",
                "description": "Requires public:write. API keys are bound to a municipality and a currently authorized, verified municipal manager. Only public-detail-visible reports may be updated. Existing public/official permissions and workflow validations apply. Read edit_version with a key that also has public:read. A repeated request with the previous version is rejected; do not retry a timed-out write without reading the latest state. The creator must be an actual authorized member of the verified municipality. Platform administrator status alone does not grant official public-write authority.",
                "x-required-scopes": [
                    "public:write"
                ],
                "security": [
                    {
                        "municipalityKey": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ReportEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing, invalid, expired, revoked key or inactive creator authorization.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Scope, package or permission denied.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Municipality or report not available to this key.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Stale edit_version. Reload and review before retrying.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Invalid or unsupported input fields.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded. Observe Retry-After.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds until a retry is allowed.",
                                "schema": {
                                    "type": "integer"
                                }
                            }
                        }
                    },
                    "415": {
                        "description": "Unsupported media type. Use Content-Type: application/json.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "municipality",
                        "in": "path",
                        "required": true,
                        "description": "The municipality slug bound to this API key.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "report",
                        "in": "path",
                        "required": true,
                        "description": "Public report code, not a numeric database ID.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/ProgressUpdate"
                            }
                        }
                    }
                }
            }
        },
        "/municipalities/{municipality}/reports/{report}/notes": {
            "get": {
                "operationId": "listInternalNotes",
                "summary": "Read internal notes",
                "description": "Requires internal:read. API keys are bound to a municipality and a currently authorized, verified municipal manager. Requires the internal collaboration package (plan 3 or higher). Supports nonpublic own-municipality reports within internal permissions. Pair with internal:write to receive meta.edit_version.",
                "x-required-scopes": [
                    "internal:read"
                ],
                "security": [
                    {
                        "municipalityKey": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/NotePage"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing, invalid, expired, revoked key or inactive creator authorization.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Scope, package or permission denied.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Municipality or report not available to this key.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Stale edit_version. Reload and review before retrying.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Invalid or unsupported input fields.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded. Observe Retry-After.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds until a retry is allowed.",
                                "schema": {
                                    "type": "integer"
                                }
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "municipality",
                        "in": "path",
                        "required": true,
                        "description": "The municipality slug bound to this API key.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "report",
                        "in": "path",
                        "required": true,
                        "description": "Public report code, not a numeric database ID.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "description": "Pagination page.",
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "description": "Maximum page size 100.",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "default": 25
                        }
                    }
                ]
            },
            "post": {
                "operationId": "createInternalNote",
                "summary": "Append an internal note",
                "description": "Requires internal:write. API keys are bound to a municipality and a currently authorized, verified municipal manager. Requires plan 3 or higher. Does not change public status or grant public write access. Read meta.edit_version via listInternalNotes using internal:read.",
                "x-required-scopes": [
                    "internal:write"
                ],
                "security": [
                    {
                        "municipalityKey": []
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Success.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/NoteEnvelope"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing, invalid, expired, revoked key or inactive creator authorization.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Scope, package or permission denied.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Municipality or report not available to this key.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Stale edit_version. Reload and review before retrying.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Invalid or unsupported input fields.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded. Observe Retry-After.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds until a retry is allowed.",
                                "schema": {
                                    "type": "integer"
                                }
                            }
                        }
                    },
                    "415": {
                        "description": "Unsupported media type. Use Content-Type: application/json.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "municipality",
                        "in": "path",
                        "required": true,
                        "description": "The municipality slug bound to this API key.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "report",
                        "in": "path",
                        "required": true,
                        "description": "Public report code, not a numeric database ID.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/NoteCreate"
                            }
                        }
                    }
                }
            }
        },
        "/municipalities/{municipality}/reports/{report}/comments": {
            "get": {
                "operationId": "listPublicComments",
                "summary": "Read public comments and municipal responses",
                "description": "Requires public:read. Only own-municipality, public-detail-visible reports are available. Internal, hidden or unconfirmed comments are excluded. Returns no author account details.",
                "x-required-scopes": [
                    "public:read"
                ],
                "security": [
                    {
                        "municipalityKey": []
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/PublicCommentPage"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Missing, invalid, expired, revoked key or inactive creator authorization.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "403": {
                        "description": "Scope, package or permission denied.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Municipality or report not available to this key.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "409": {
                        "description": "Stale edit_version. Reload and review before retrying.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Invalid or unsupported input fields.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded. Observe Retry-After.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        },
                        "headers": {
                            "Retry-After": {
                                "description": "Seconds until a retry is allowed.",
                                "schema": {
                                    "type": "integer"
                                }
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "municipality",
                        "in": "path",
                        "required": true,
                        "description": "The municipality slug bound to this API key.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "report",
                        "in": "path",
                        "required": true,
                        "description": "Public report code, not a numeric database ID.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "description": "Pagination page.",
                        "schema": {
                            "type": "integer",
                            "minimum": 1
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "description": "Maximum page size 100.",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100,
                            "default": 25
                        }
                    }
                ]
            }
        }
    },
    "components": {
        "securitySchemes": {
            "municipalityKey": {
                "type": "http",
                "scheme": "bearer",
                "bearerFormat": "r360_<64 hexadecimal characters>",
                "description": "Send only in Authorization header. Never put in a URL, public browser client or mobile application. The secret is shown once and is not recoverable."
            }
        },
        "schemas": {
            "Report": {
                "type": "object",
                "required": [
                    "code",
                    "type",
                    "title",
                    "description",
                    "status",
                    "status_label",
                    "municipality",
                    "category"
                ],
                "properties": {
                    "code": {
                        "type": "string",
                        "example": "ABCD-2345"
                    },
                    "type": {
                        "type": "string",
                        "enum": [
                            "problem",
                            "idea"
                        ]
                    },
                    "title": {
                        "type": "string"
                    },
                    "description": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "open",
                            "progress",
                            "external",
                            "done"
                        ]
                    },
                    "status_label": {
                        "type": "string"
                    },
                    "closure_reason": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "municipality": {
                        "type": "object",
                        "required": [
                            "slug",
                            "name"
                        ],
                        "properties": {
                            "slug": {
                                "type": "string"
                            },
                            "name": {
                                "type": "string"
                            }
                        }
                    },
                    "category": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": [
                                    "integer",
                                    "null"
                                ]
                            },
                            "name": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        }
                    },
                    "latitude": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "longitude": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "next_step": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "next_update_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "published_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "public_updated_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "edit_version": {
                        "type": "string",
                        "description": "Opaque optimistic-concurrency token. Present for a key with public:write or internal:write. Read again after every write."
                    },
                    "internal": {
                        "type": "object",
                        "description": "Only returned with visibility=internal and both read scopes. Never part of the default public resource.",
                        "properties": {
                            "published": {
                                "type": "boolean"
                            },
                            "assigned_to": {
                                "type": [
                                    "integer",
                                    "null"
                                ]
                            },
                            "workflow_status": {
                                "type": "string"
                            }
                        }
                    }
                }
            },
            "ReportEnvelope": {
                "type": "object",
                "required": [
                    "data"
                ],
                "properties": {
                    "data": {
                        "$ref": "#/components/schemas/Report"
                    }
                }
            },
            "ReportPage": {
                "type": "object",
                "required": [
                    "data",
                    "meta",
                    "links"
                ],
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Report"
                        }
                    },
                    "meta": {
                        "type": "object",
                        "required": [
                            "current_page",
                            "last_page",
                            "per_page",
                            "total"
                        ],
                        "properties": {
                            "current_page": {
                                "type": "integer"
                            },
                            "last_page": {
                                "type": "integer"
                            },
                            "per_page": {
                                "type": "integer",
                                "maximum": 100
                            },
                            "total": {
                                "type": "integer"
                            },
                            "edit_version": {
                                "type": "string",
                                "description": "Notes pagination includes this for internal:write keys."
                            }
                        }
                    },
                    "links": {
                        "type": "object",
                        "properties": {
                            "next": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "prev": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        }
                    }
                }
            },
            "Note": {
                "type": "object",
                "required": [
                    "id",
                    "body",
                    "created_at"
                ],
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "body": {
                        "type": "string"
                    },
                    "created_at": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                }
            },
            "NotePage": {
                "type": "object",
                "required": [
                    "data",
                    "meta",
                    "links"
                ],
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Note"
                        }
                    },
                    "meta": {
                        "type": "object",
                        "required": [
                            "current_page",
                            "last_page",
                            "per_page",
                            "total"
                        ],
                        "properties": {
                            "current_page": {
                                "type": "integer"
                            },
                            "last_page": {
                                "type": "integer"
                            },
                            "per_page": {
                                "type": "integer",
                                "maximum": 100
                            },
                            "total": {
                                "type": "integer"
                            },
                            "edit_version": {
                                "type": "string",
                                "description": "Notes pagination includes this for internal:write keys."
                            }
                        }
                    },
                    "links": {
                        "type": "object",
                        "properties": {
                            "next": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "prev": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        }
                    }
                }
            },
            "NoteEnvelope": {
                "type": "object",
                "required": [
                    "data",
                    "meta"
                ],
                "properties": {
                    "data": {
                        "$ref": "#/components/schemas/Note"
                    },
                    "meta": {
                        "type": "object",
                        "properties": {
                            "edit_version": {
                                "type": "string"
                            }
                        }
                    }
                }
            },
            "ProgressUpdate": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                    "edit_version",
                    "status",
                    "message"
                ],
                "properties": {
                    "edit_version": {
                        "type": "string",
                        "minLength": 64,
                        "maxLength": 64
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "open",
                            "progress",
                            "external",
                            "done"
                        ]
                    },
                    "message": {
                        "type": "string",
                        "minLength": 10,
                        "maxLength": 3000
                    },
                    "closure_reason": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "Required for status done. With ideas, fixed maps to implemented and rejected to not feasible.",
                        "enum": [
                            "fixed",
                            "rejected",
                            "not_responsible",
                            "duplicate",
                            "other"
                        ]
                    }
                },
                "allOf": [
                    {
                        "if": {
                            "properties": {
                                "status": {
                                    "const": "done"
                                }
                            }
                        },
                        "then": {
                            "required": [
                                "closure_reason"
                            ],
                            "properties": {
                                "closure_reason": {
                                    "type": "string"
                                }
                            }
                        }
                    }
                ]
            },
            "NoteCreate": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                    "edit_version",
                    "body"
                ],
                "properties": {
                    "edit_version": {
                        "type": "string",
                        "minLength": 64,
                        "maxLength": 64
                    },
                    "body": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 5000
                    }
                }
            },
            "Error": {
                "type": "object",
                "required": [
                    "message"
                ],
                "properties": {
                    "message": {
                        "type": "string"
                    },
                    "errors": {
                        "type": "object",
                        "additionalProperties": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        }
                    }
                }
            },
            "PublicCommentPage": {
                "type": "object",
                "required": [
                    "data",
                    "meta",
                    "links"
                ],
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Note"
                        }
                    },
                    "meta": {
                        "type": "object",
                        "required": [
                            "current_page",
                            "last_page",
                            "per_page",
                            "total"
                        ],
                        "properties": {
                            "current_page": {
                                "type": "integer"
                            },
                            "last_page": {
                                "type": "integer"
                            },
                            "per_page": {
                                "type": "integer",
                                "maximum": 100
                            },
                            "total": {
                                "type": "integer"
                            }
                        }
                    },
                    "links": {
                        "type": "object",
                        "properties": {
                            "next": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "prev": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        }
                    }
                }
            }
        }
    }
}