{
  "openapi": "3.0.4",
  "info": {
    "title": "IslandIs Documents API V1",
    "version": "v1"
  },
  "paths": {
    "/api/v1/Documents": {
      "get": {
        "tags": [
          "Documents"
        ],
        "parameters": [
          {
            "name": "senderKennitala",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "dateFrom",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "dateTo",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "categoryId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "typeId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "archived",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "order",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/Order"
            }
          },
          {
            "name": "opened",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 15
            }
          },
          {
            "name": "bookmarked",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentListView"
                }
              }
            }
          },
          "204": {
            "description": "No Content"
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/Documents/types": {
      "get": {
        "tags": [
          "Documents"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/MessageTypeDTO"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/Documents/categories": {
      "get": {
        "tags": [
          "Documents"
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/MessageCategoryDTO"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/Documents/{documentId}": {
      "get": {
        "tags": [
          "Documents"
        ],
        "parameters": [
          {
            "name": "documentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentDTO"
                }
              }
            }
          },
          "204": {
            "description": "No Content"
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/Documents/{documentId}/read": {
      "post": {
        "tags": [
          "Documents"
        ],
        "parameters": [
          {
            "name": "documentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No Content"
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/Documents/{documentId}/archive": {
      "post": {
        "tags": [
          "Documents"
        ],
        "parameters": [
          {
            "name": "documentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentArchiveRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentArchiveRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentArchiveRequest"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "No Content"
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/Documents/{documentId}/bookmark": {
      "post": {
        "tags": [
          "Documents"
        ],
        "parameters": [
          {
            "name": "documentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentBookmarkRequest"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentBookmarkRequest"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentBookmarkRequest"
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "No Content"
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "DocumentArchiveRequest": {
        "type": "object",
        "properties": {
          "archived": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "DocumentBookmarkRequest": {
        "type": "object",
        "properties": {
          "bookmarked": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "DocumentDTO": {
        "required": [
          "fileType"
        ],
        "type": "object",
        "properties": {
          "fileType": {
            "type": "string"
          },
          "content": {
            "type": "string",
            "nullable": true
          },
          "htmlContent": {
            "type": "string",
            "nullable": true
          },
          "urlContent": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "DocumentListItem": {
        "required": [
          "categoryId",
          "senderName",
          "senderNationalId",
          "subject"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "documentDate": {
            "type": "string",
            "format": "date-time"
          },
          "publicationDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "senderNationalId": {
            "type": "string"
          },
          "senderName": {
            "type": "string"
          },
          "subject": {
            "type": "string"
          },
          "categoryId": {
            "type": "string"
          },
          "opened": {
            "type": "boolean"
          },
          "bookmarked": {
            "type": "boolean"
          },
          "urgent": {
            "type": "boolean"
          },
          "replyable": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "DocumentListView": {
        "type": "object",
        "properties": {
          "documents": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentListItem"
            }
          },
          "unreadCount": {
            "type": "integer",
            "format": "int32"
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer",
            "format": "int32"
          },
          "detail": {
            "type": "string"
          },
          "instance": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "MessageCategoryDTO": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "MessageTypeDTO": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "Order": {
        "enum": [
          "Ascending",
          "Descending"
        ],
        "type": "string"
      }
    }
  },
  "tags": [
    {
      "name": "Documents"
    }
  ]
}