openapi: "3.0.3"
info:
  description: RESTful API designed as the Message Registry contracts of the e-Box Federation.
  version: "3.5"
  title: e-Box REST API
  contact:
    name: eBoxIntegration
    email: eBoxIntegration@smals.be
  license:
    name: e-Box
    url: http://www.digitalbelgium.be
security:
  - Oauth:
      [ 'scope:document:management:consult:ws-eboxrestentreprise:documentconsumer',
        'scope:document:management:consult:ws-eboxrestentreprise:publicationmandate',
        'scope:document:management:consult:ws-eboxrestentreprise:publicationsender',
        'scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseadmin',
        'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryadmin',
        'scope:document:management:consult:ws-eboxrestentreprise:eboxresponsible',
        'scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseuser',
        'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryuser',
        'scope:document:management:consult:ws-eboxrestentreprise:publicationweb',
        'scope:document:management:ws-eboxrestentreprise:eboxrepresentativepublication',
        'scope:document:management:ws-eboxrestentreprise:eboxrepresentativeconsultation',
        'scope:document:management:consult:ws-eboxrestentreprise:eventnotification:push',
        'scope:rsz-onss:administration:ebox-management-rest:admin',
        'scope:document:management:consult:ws-eboxrestentreprise:monitoring']
tags:
  - name: Messages
  - name: ReferenceData
  - name: Statistics
  - name: Publication
  - name: Reply
  - name: Webhooks
  - name: Monitoring
servers:
  - url: "/REST/ebox/enterprise/messageRegistry/v3"
  - url: "/REST/ebox/citizen/messageRegistry/v3"
paths:
  /ebox/messages:
    get:
      tags:
        - Messages
      summary: Get a collection of messages.
      description: Messages are the main elements contained in an ebox. A message is basically composed of a set of metadata (e.g. subject, receipt date, etc.), one body, one or more attachments. The ebox identity is retrieved from the user's credential. Without query parameters, it returns all the messages that the user can consult in the e-Box but the response still pagined. The messages are sorted by the publication date in descending order (newest first).
      operationId: getEboxMessages
      parameters:
        - $ref: '#/components/parameters/EnterpriseNumberHeader'
        - name: page
          in: query
          description: The index of the current page of items.
          required: false
          schema:
            type: integer
            default: 1
            minimum: 1
        - name: pageSize
          in: query
          description: The maximal number of results per page.
          required: false
          schema:
            type: integer
            default: 25
            maximum: 100
            minimum: 1
        - name: receivedBefore
          in: query
          description: Select only the messages received before the given date.
          example: "2017-07-01"
          required: false
          schema:
            type: string
            format: date
        - name: receivedAfter
          in: query
          description: Select only the messages received after the given date.
          example: "2017-07-01"
          required: false
          schema:
            type: string
            format: date
        - name: expiredBefore
          in: query
          description: Select only the messages that will expire before the given date.
          example: "2017-07-01"
          required: false
          schema:
            type: string
            format: date
        - name: expiredAfter
          in: query
          description: Select only the messages that will expire after the given date.
          example: "2020-01-01"
          required: false
          schema:
            type: string
            format: date
        - name: read
          in: query
          description: If true, it filters on read messages. If false, it filters on unread messages.
          required: false
          schema:
            type: boolean
        - name: visible
          in: query
          description: It filters on visible messages if set to true. It filters on hidden messages if set to false.
          required: false
          schema:
            type: boolean
        - name: messageTypeId
          in: query
          description: This parameters filters on the messageTypeId linked to the messages.
          required: false
          schema:
            type: string
        - name: enterpriseNumber
          in: query
          description: This parameters filters on sender organization. The value is the identifier issued by CBE.
          required: false
          schema:
            $ref: "#/components/schemas/EnterpriseNumber"
        - name: senderApplicationId
          in: query
          description: This parameters filters on the applicationId that identifies the sender application.
          required: false
          schema:
            type: string
        - name: recipientPartition
          in: query
          description: This parameter filters on the ebox partition where the messages are received.
          required: false
          schema:
            type: string
        - name: senderPartition
          in: query
          description: This parameter filters on the ebox partition that sent the messages
          required: false
          schema:
            type: string
        - name: registeredMail
          in: query
          description: If set to true, it filters on registered mails (including notifications of qualified registered mails).
          required: false
          schema:
            type: boolean
        - name: requiredAction
          in: query
          description: It filters on messages which the sender specified that an action from the recipient is required. It also takes messages which the recipient has confirmed the action execution. A message with a required action is a message where in the messageActionsStatus array, there is one action of type requiredActionToConfirm.
          required: false
          schema:
            type: boolean
        - name: requiredActionNotExecuted
          in: query
          description: It filters on messages which the sender specified that an action from the recipient is required and the recipient has not yet confirm the action execution.
          required: false
          schema:
            type: boolean
        - name: requiredActionDueDateBefore
          in: query
          description: Select the messages which the sender specified that an action from the recipient is required before the given date.
          example: 2017-07-01
          required: false
          schema:
            type: string
            format: date
        - name: requiredActionDueDateAfter
          in: query
          description: Select the messages which the sender specified that an action from the recipient is required after the given date.
          example: 2017-07-01
          required: false
          schema:
            type: string
            format: date
        - name: q
          in: query
          description: It filters messages containing the search parameter in the metadata of the message or the reference data of the organization, application or message type
          required: false
          schema:
            type: string
        - name: qlang
          in: query
          description: For textual search, only search in the textual data of the chosen language. This query parameter is required in a request that contains the 'q' query parameter. The resulting list of messages will only consist of messages that contain the search parameter in the language defined in the qlang parameter
          required: false
          schema:
            type: string
        - name: folder
          in: query
          description: The folder where the messages should be retrieved. If set to in, the messages returned are messages in the user's e-Box and that the user can read. If set to out, the message returned are sent messages.
          schema:
            type: string
            default: in
            enum:
              - in
              - out
      responses:
        200:
          description: successful operation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Messages"
        400:
          $ref: "#/components/responses/BadRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        403:
          $ref: "#/components/responses/Forbidden"
        default:
          description: "error payload"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      security:
        - Oauth:
            ['scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxresponsible',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseuser',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryuser',
             'scope:document:management:consult:ws-eboxrestentreprise:documentconsumer',
             'scope:document:management:ws-eboxrestentreprise:eboxrepresentativeconsultation']
      x-oauth2-required-scopes: any
    post:
      tags:
        - Publication
      summary: Publish a new message
      description: "Publish a new message, using multipart request: one JSON as the message description and one or more attachments. The implementation of this part is optional. The client must be onboarded as a Document Sender in order to have the right to publish. The attachments should not exceed 100 MB."
      operationId: postMessage
      parameters:
        - $ref: '#/components/parameters/EnterpriseNumberHeader'
        - $ref: '#/components/parameters/IdempotencyKeyHeader'
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                messageToPublish:
                  $ref: "#/components/schemas/MessageToPublish"
                upfile1:
                  type: string
                  format: binary
                upfile2:
                  type: string
                  format: binary
                upfile3:
                  type: string
                  format: binary
                upfile4:
                  type: string
                  format: binary
                upfile5:
                  type: string
                  format: binary
                upfile6:
                  type: string
                  format: binary
                upfile7:
                  type: string
                  format: binary
                upfile8:
                  type: string
                  format: binary
                upfile9:
                  type: string
                  format: binary
                upfile10:
                  type: string
                  format: binary
                qrfile:
                  type: string
                  format: binary
              required:
                - messageToPublish
      responses:
        201:
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PublicationStatusMessage"
        400:
          $ref: "#/components/responses/BadRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        403:
          $ref: "#/components/responses/Forbidden"
        404:
          $ref: "#/components/responses/NotFound"
        default:
          description: "error payload"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      security:
        - Oauth:
            ['scope:rsz-onss:administration:ebox-management-rest:admin',
             'scope:document:management:consult:ws-eboxrestentreprise:publicationmandate',
             'scope:document:management:consult:ws-eboxrestentreprise:publicationsender',
             'scope:document:management:consult:ws-eboxrestentreprise:publicationweb',
             'scope:document:management:ws-eboxrestentreprise:eboxrepresentativepublication']
      x-oauth2-required-scopes: any

  /ebox/messages/{messageId}:
    get:
      tags:
        - Messages
      summary: Get a message by its messageId
      description: Get details on one message that the user can consult.
      operationId: getMessageById
      parameters:
        - $ref: '#/components/parameters/EnterpriseNumberHeader'
        - name: messageId
          in: path
          description: The identifier of the message
          required: true
          schema:
            type: string
      responses:
        200:
          description: successful operation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Message"
        401:
          $ref: "#/components/responses/Unauthorized"
        403:
          $ref: "#/components/responses/Forbidden"
        404:
          $ref: "#/components/responses/NotFound"
        default:
          description: "error payload"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      security:
        - Oauth:
            ['scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxresponsible',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseuser',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryuser',
             'scope:document:management:consult:ws-eboxrestentreprise:documentconsumer',
             'scope:document:management:ws-eboxrestentreprise:eboxrepresentativeconsultation']
      x-oauth2-required-scopes: any

  /ebox/messages/{messageId}/attachments/{attachmentId}/content:
    get:
      tags:
        - Messages
      summary: Download the attachment content by its attachmentId
      description: Download the attachment in a message that the user can consult. If the attachment content downloaded is the main content then the message will be marked as read.
      operationId: getAttachmentContentById
      parameters:
        - $ref: '#/components/parameters/EnterpriseNumberHeader'
        - name: messageId
          in: path
          description: The identifier of the message
          required: true
          schema:
            type: string
        - name: attachmentId
          in: path
          description: The identifier of the attachment
          required: true
          schema:
            type: string
      responses:
        200:
          description: successful operation
          content:
            application/octet-stream:
              schema:
                type: string
                format: binary
        401:
          $ref: "#/components/responses/Unauthorized"
        403:
          $ref: "#/components/responses/Forbidden"
        404:
          $ref: "#/components/responses/NotFound"
        default:
          description: "error payload"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      security:
        - Oauth:
            ['scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxresponsible',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseuser',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryuser',
             'scope:document:management:consult:ws-eboxrestentreprise:documentconsumer',
             'scope:document:management:ws-eboxrestentreprise:eboxrepresentativeconsultation']
      x-oauth2-required-scopes: any

  /ebox/messages/{messageId}/body:
    get:
      tags:
        - Messages
      summary: Get the body content
      description: The implementation of this operation is optional. Get the body of a message that the user can consult. The body can be unexisting, giving a 404 response code in that case.
      operationId: getBodyContent
      parameters:
        - $ref: '#/components/parameters/EnterpriseNumberHeader'
        - name: messageId
          in: path
          description: The identifier of the message
          required: true
          schema:
            type: string
      responses:
        200:
          description: successful operation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LocalizedString"
        401:
          $ref: "#/components/responses/Unauthorized"
        403:
          $ref: "#/components/responses/Forbidden"
        404:
          $ref: "#/components/responses/NotFound"
        default:
          description: "error payload"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      security:
        - Oauth:
            ['scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxresponsible',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseuser',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryuser',
             'scope:document:management:consult:ws-eboxrestentreprise:documentconsumer',
             'scope:document:management:ws-eboxrestentreprise:eboxrepresentativeconsultation']
      x-oauth2-required-scopes: any

  /ebox/messages/{messageId}/notifications:
    get:
      tags:
        - Messages
      summary: Get info on message notificiations available for the message
      description: The implementation of this operation is optional. Get info on notifications available for the message. The notifications can be unexisting for the message, giving a 404 response code in that case.
      operationId: getMessageNotifications
      parameters:
        - $ref: '#/components/parameters/EnterpriseNumberHeader'
        - name: messageId
          in: path
          description: The identifier of the message
          required: true
          schema:
            type: string
      responses:
        200:
          description: successful operation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Notifications"
        401:
          $ref: "#/components/responses/Unauthorized"
        403:
          $ref: "#/components/responses/Forbidden"
        404:
          $ref: "#/components/responses/NotFound"
        default:
          description: "error payload"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      security:
        - Oauth:
            ['scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxresponsible',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseuser',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryuser',
             'scope:document:management:consult:ws-eboxrestentreprise:documentconsumer',
             'scope:document:management:ws-eboxrestentreprise:eboxrepresentativeconsultation']
      x-oauth2-required-scopes: any

  /ebox/messages/{messageId}/messageActions:
    get:
      x-ignore-rules:
        "col-repres": Exempt existing arrays to be root json objects
        "rule identifier": "Already like this in the previous minor version. Will be changed for the next major version"
      tags:
        - Messages
      summary: Get status info on message actions available for the message
      description: The implementation of this operation is optional. Get status info on message actions available for the message. The messageActionStatus can be unexisting for the message, giving a 404 response code in that case.
      operationId: getMessageActionStatus
      parameters:
        - $ref: '#/components/parameters/EnterpriseNumberHeader'
        - name: messageId
          in: path
          description: The identifier of the message
          required: true
          schema:
            type: string
      responses:
        200:
          description: successful operation
          content:
            application/json:
              x-ignore-rules:
                "evo-object": Exempt existing arrays to be root json objects
                "rule identifier": "Already like this in the previous minor version. Will be changed for the next major version"
              schema:
                $ref: "#/components/schemas/MessageActionStatusList"
        401:
          $ref: "#/components/responses/Unauthorized"
        403:
          $ref: "#/components/responses/Forbidden"
        404:
          $ref: "#/components/responses/NotFound"
        default:
          description: "error payload"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      security:
        - Oauth:
            ['scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxresponsible',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseuser',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryuser',
             'scope:document:management:consult:ws-eboxrestentreprise:documentconsumer',
             'scope:document:management:ws-eboxrestentreprise:eboxrepresentativeconsultation']
      x-oauth2-required-scopes: any

  /ebox/messages/{messageId}/paymentData:
    get:
      tags:
        - Messages
      summary: Get the paymentData of a message
      description: "Get the paymentData of a message. A message has a payment data if the Message object has the boolean ``hasPayment`` set to true. The implementation of this operation is optional"
      operationId: getPaymentDataByMessageId
      parameters:
        - $ref: '#/components/parameters/EnterpriseNumberHeader'
        - name: messageId
          in: path
          description: The identifier of the message
          required: true
          schema:
            type: string
      responses:
        200:
          description: successful operation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PaymentData"
        401:
          $ref: "#/components/responses/Unauthorized"
        403:
          $ref: "#/components/responses/Forbidden"
        404:
          $ref: "#/components/responses/NotFound"
        default:
          description: "error payload"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      security:
        - Oauth:
            ['scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxresponsible',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseuser',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryuser',
             'scope:document:management:consult:ws-eboxrestentreprise:documentconsumer',
             'scope:document:management:ws-eboxrestentreprise:eboxrepresentativeconsultation']
      x-oauth2-required-scopes: any

  /ebox/messages/{messageId}/paymentData/qrCode/content:
    get:
      tags:
        - Messages
      summary: Get the QR Code content
      description: Get the QR code content in payment data of a message that the user can consult. The payment data can be unexisting. The implementation of this operation is optional.
      operationId: getQrcodeContent
      parameters:
        - $ref: '#/components/parameters/EnterpriseNumberHeader'
        - name: messageId
          in: path
          description: The identifier of the message
          required: true
          schema:
            type: string
      responses:
        200:
          description: successful operation
          content:
            application/octet-stream:
              schema:
                type: string
                format: binary
        401:
          $ref: "#/components/responses/Unauthorized"
        403:
          $ref: "#/components/responses/Forbidden"
        404:
          $ref: "#/components/responses/NotFound"
        default:
          description: "error payload"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      security:
        - Oauth:
            ['scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxresponsible',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseuser',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryuser',
             'scope:document:management:consult:ws-eboxrestentreprise:documentconsumer',
             'scope:document:management:ws-eboxrestentreprise:eboxrepresentativeconsultation']
      x-oauth2-required-scopes: any

  /ebox/messages/{messageId}/structuredData:
    get:
      tags:
        - Messages
      summary: Get the message data by its messageId
      description: Get the message data by its messageId if the message has structured data to process available. The implementation of this operation is optional.
      operationId: getMessageDataByMessageId
      parameters:
        - $ref: '#/components/parameters/EnterpriseNumberHeader'
        - name: messageId
          in: path
          description: The identifier of the message
          required: true
          schema:
            type: string
      responses:
        200:
          description: successful operation
          content:
            text/plain:
              x-ignore-rules:
                "rep-struct": "Validator does not accept text/plain although it is documented here: https://swagger.io/docs/specification/v3_0/describing-responses/"
              schema:
                description: The structured data to process structure exists to convey information that SHOULD NOT be displayed to the endUser.
                type: string
        401:
          $ref: "#/components/responses/Unauthorized"
        403:
          $ref: "#/components/responses/Forbidden"
        404:
          $ref: "#/components/responses/NotFound"
        default:
          description: "error payload"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      security:
        - Oauth:
            ['scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxresponsible',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseuser',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryuser',
             'scope:document:management:consult:ws-eboxrestentreprise:documentconsumer',
             'scope:document:management:ws-eboxrestentreprise:eboxrepresentativeconsultation']
      x-oauth2-required-scopes: any

  /ebox/messages/changeVisibility:
    post:
      tags:
        - Messages
      summary: Change the visibility for several messages
      description: Change the visibility on a set of messages to hide or unhide them.
      operationId: changeMessagesVisibility
      parameters:
        - $ref: '#/components/parameters/EnterpriseNumberHeader'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ChangeVisibility"
      responses:
        204:
          description: successful operation
        400:
          $ref: "#/components/responses/BadRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        403:
          $ref: "#/components/responses/Forbidden"
        404:
          $ref: "#/components/responses/NotFound"
        default:
          description: "error payload"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      security:
        - Oauth:
            ['scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxresponsible',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseuser',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryuser',
             'scope:document:management:consult:ws-eboxrestentreprise:documentconsumer',
             'scope:document:management:ws-eboxrestentreprise:eboxrepresentativeconsultation']
      x-oauth2-required-scopes: any

  /ebox/messages/changePartition:
    post:
      tags:
        - Messages
      summary: Move messages to another partition
      description: Move messages to another partition. The recipient can move messages from one partition to another in its own e-Box. The sender can change the senderPartition to another in its own e-Box.
      operationId: moveMessages
      parameters:
        - $ref: '#/components/parameters/EnterpriseNumberHeader'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ChangePartition"
      responses:
        204:
          description: successful operation
        400:
          $ref: "#/components/responses/BadRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        403:
          $ref: "#/components/responses/Forbidden"
        404:
          $ref: "#/components/responses/NotFound"
        default:
          description: "error payload"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      security:
        - Oauth:
            ['scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxresponsible',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseuser',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryuser',
             'scope:document:management:consult:ws-eboxrestentreprise:documentconsumer',
             'scope:document:management:ws-eboxrestentreprise:eboxrepresentativeconsultation']
      x-oauth2-required-scopes: any

  /ebox/messages/{messageId}/reply:
    post:
      tags:
        - Reply
      summary: Reply on a given message by its messageId.
      description: Reply on a given message by its messageId. The client must have a right to consult the message in order to reply it. The attachments should not exceed 100 MB for enterprise, 8MB for citizen.
      operationId: replyMessage
      parameters:
        - $ref: '#/components/parameters/EnterpriseNumberHeader'
        - name: messageId
          in: path
          description: The identifier of the message
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                messageToReply:
                  $ref: "#/components/schemas/MessageToReply"
                upfile1:
                  description: File content
                  type: string
                  format: binary
                upfile2:
                  type: string
                  format: binary
                upfile3:
                  type: string
                  format: binary
                upfile4:
                  type: string
                  format: binary
                upfile5:
                  type: string
                  format: binary
                upfile6:
                  type: string
                  format: binary
                upfile7:
                  type: string
                  format: binary
                upfile8:
                  type: string
                  format: binary
                upfile9:
                  type: string
                  format: binary
                upfile10:
                  type: string
                  format: binary
              required:
                - messageToReply
      responses:
        201:
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ReplyStatusMessage"
        400:
          $ref: "#/components/responses/BadRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        403:
          $ref: "#/components/responses/Forbidden"
        404:
          $ref: "#/components/responses/NotFound"
        default:
          description: "error payload"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      security:
        - Oauth:
            ['scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxresponsible',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseuser',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryuser',
             'scope:document:management:consult:ws-eboxrestentreprise:documentconsumer',
             'scope:document:management:ws-eboxrestentreprise:eboxrepresentativeconsultation']
      x-oauth2-required-scopes: any

  /messageActions/{messageActionId}:
    get:
      tags:
        - Reply
      summary: Get a message action by its messageActionId
      description: Get a message action by its messageActionId. The implementation of this operation is optional. See the MessageAction object description for more info about message actions.
      operationId: getMessageActionById
      parameters:
        - $ref: '#/components/parameters/EnterpriseNumberHeader'
        - name: messageActionId
          in: path
          description: The identifier of the action
          required: true
          schema:
            type: string
      responses:
        200:
          description: successful operation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MessageAction"
        401:
          $ref: "#/components/responses/Unauthorized"
        403:
          $ref: "#/components/responses/Forbidden"
        404:
          $ref: "#/components/responses/NotFound"
        default:
          description: "error payload"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      security:
        - Oauth:
            ['scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxresponsible',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseuser',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryuser',
             'scope:document:management:consult:ws-eboxrestentreprise:documentconsumer',
             'scope:document:management:ws-eboxrestentreprise:eboxrepresentativeconsultation']
      x-oauth2-required-scopes: any

  /messageTemplates/{messageTemplateId}:
    get:
      tags:
        - Reply
      summary: Get a message template by its messageTemplateId.
      description: Get a message template by its messageTemplateId. The implementation of this operation is optional
      operationId: getMessageTemplateById
      parameters:
        - $ref: '#/components/parameters/EnterpriseNumberHeader'
        - name: messageTemplateId
          in: path
          description: The identifier of the messageTemplateId
          required: true
          schema:
            type: string
      responses:
        200:
          description: successful operation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MessageTemplate"
        401:
          $ref: "#/components/responses/Unauthorized"
        403:
          $ref: "#/components/responses/Forbidden"
        404:
          $ref: "#/components/responses/NotFound"
        default:
          description: "error payload"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      security:
        - Oauth:
            ['scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxresponsible',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseuser',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryuser',
             'scope:document:management:consult:ws-eboxrestentreprise:documentconsumer',
             'scope:document:management:ws-eboxrestentreprise:eboxrepresentativeconsultation']
      x-oauth2-required-scopes: any

  /ebox/messages/{messageId}/messageActions/{messageActionId}:
    patch:
      tags:
        - Reply
      summary: Confirm or unconfirm that one action was executed for a message
      description: Confirm or unconfirm that one action was executed for a message. The actions of type replyWithExternalForm or requiredActionToConfirm can be confirmed. The actions of type requiredActionToConfirm can be unconfirmed.
      operationId: patchMessageActionStatus
      parameters:
        - $ref: '#/components/parameters/EnterpriseNumberHeader'
        - name: messageId
          in: path
          description: The identifier of the message (can only be a message belonging to the Sender executing the call)
          required: true
          schema:
            type: string
        - name: messageActionId
          in: path
          description: The identifier of the message action that has been executed on the message
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/merge-patch+json:
            schema:
              $ref: "#/components/schemas/MessageActionStatusToPatch"
        description: Data about a message action status that can be patched.
      responses:
        204:
          description: successful operation
        400:
          $ref: "#/components/responses/BadRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        403:
          $ref: "#/components/responses/Forbidden"
        404:
          $ref: "#/components/responses/NotFound"
        default:
          description: "error payload"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      security:
        - Oauth:
            ['scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxresponsible',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseuser',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryuser',
             'scope:document:management:consult:ws-eboxrestentreprise:documentconsumer',
             'scope:document:management:ws-eboxrestentreprise:eboxrepresentativeconsultation']
      x-oauth2-required-scopes: any

  /refData/messageTypes:
    get:
      x-ignore-rules:
        "col-repres": Exempt existing arrays to be root json objects
        "rule identifier": "Already like this in the previous minor version. Will be changed for the next major version"
      tags:
        - ReferenceData
      summary: Get a collection of MessageTypes
      description: Get a collection of MessageTypes. MessageTypes are the different types of messages defined by the senders. A messageType usually corresponds to a business category of a letter or document (e.g. attestation X., declaration Y., communication Z., etc.).
      operationId: getAllMessagesTypes
      parameters:
        - name: "senderOrganizationId"
          in: "query"
          schema:
            type: string
            example: "0406798006"
            description: Enterprise number of the sender organisation
            pattern: '^[0-1]\d{9}$'
        - name: "senderApplicationId"
          in: "query"
          schema:
            type: string
            description: Identifier of the senderApplication
      responses:
        200:
          description: successful operation
          content:
            application/json:
              x-ignore-rules:
                "evo-object": Exempt existing arrays to be root json objects
                "rule identifier": "Already like this in the previous minor version. Will be changed for the next major version"
              schema:
                $ref: "#/components/schemas/MessageTypeList"
        401:
          $ref: "#/components/responses/Unauthorized"
        403:
          $ref: "#/components/responses/Forbidden"
        default:
          description: "error payload"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      security:
        - Oauth:
            ['scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxresponsible',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseuser',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryuser',
             'scope:document:management:consult:ws-eboxrestentreprise:documentconsumer',
             'scope:document:management:ws-eboxrestentreprise:eboxrepresentativeconsultation']
      x-oauth2-required-scopes: any

  /refData/messageTypes/{messageTypeId}:
    get:
      tags:
        - ReferenceData
      summary: Get a messageType by its messageTypeId
      description: Get a messageType by its messageTypeId. A messageType usually corresponds to a business category of a letter or document (e.g. attest X., declaration Y., communication Z., etc.). A messageType gives all the detailed information about a type of message, such as the name or the description.
      operationId: getMessageTypeById
      parameters:
        - name: messageTypeId
          in: path
          description: The identifier of the message type
          required: true
          schema:
            type: string
      responses:
        200:
          description: successful operation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MessageType"
        401:
          $ref: "#/components/responses/Unauthorized"
        403:
          $ref: "#/components/responses/Forbidden"
        404:
          $ref: "#/components/responses/NotFound"
        default:
          description: "error payload"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      security:
        - Oauth:
            ['scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxresponsible',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseuser',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryuser',
             'scope:document:management:consult:ws-eboxrestentreprise:documentconsumer',
             'scope:document:management:consult:ws-eboxrestentreprise:publicationmandate',
             'scope:document:management:ws-eboxrestentreprise:eboxrepresentativeconsultation']
      x-oauth2-required-scopes: any

  /refData/senderApplications:
    get:
      x-ignore-rules:
        "col-repres": Exempt existing arrays to be root json objects
        "rule identifier": "Already like this in the previous minor version. Will be changed for the next major version"
      tags:
        - ReferenceData
      summary: List all senderApplications
      description: List all senderApplications. SenderApplications are the different applications (online services...) that send messages to enterprises.
      operationId: getAllSenderApplications
      parameters:
        - name: "senderOrganizationId"
          in: "query"
          schema:
            type: string
            example: "0406798006"
            description: Enterprise number of the sender organisation
            pattern: '^[0-1]\d{9}$'
      responses:
        200:
          description: successful operation
          content:
            application/json:
              x-ignore-rules:
                "evo-object": Exempt existing arrays to be root json objects
                "rule identifier": "Already like this in the previous minor version. Will be changed for the next major version"
              schema:
                $ref: "#/components/schemas/SenderApplicationList"
        401:
          $ref: "#/components/responses/Unauthorized"
        403:
          $ref: "#/components/responses/Forbidden"
        default:
          description: "error payload"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      security:
        - Oauth:
            ['scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxresponsible',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseuser',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryuser',
             'scope:document:management:consult:ws-eboxrestentreprise:documentconsumer',
             'scope:document:management:ws-eboxrestentreprise:eboxrepresentativeconsultation']
      x-oauth2-required-scopes: any

  /refData/senderApplications/{senderApplicationId}:
    get:
      tags:
        - ReferenceData
      summary: Get a senderApplication by its senderApplicationId
      description: ""
      operationId: getSenderApplicationById
      parameters:
        - name: senderApplicationId
          in: path
          description: The applicationId of the sender
          required: true
          schema:
            type: string
      responses:
        200:
          description: "successful operation"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SenderApplication"
        401:
          $ref: "#/components/responses/Unauthorized"
        403:
          $ref: "#/components/responses/Forbidden"
        404:
          $ref: "#/components/responses/NotFound"
        default:
          description: "error payload"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      security:
        - Oauth:
            ['scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxresponsible',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseuser',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryuser',
             'scope:document:management:consult:ws-eboxrestentreprise:documentconsumer',
             'scope:document:management:ws-eboxrestentreprise:eboxrepresentativeconsultation']
      x-oauth2-required-scopes: any

  /refData/senderApplications/{senderApplicationId}/images/{imageId}/content:
    get:
      tags:
        - ReferenceData
      summary: Get the application logo
      description: ""
      operationId: getImageForSenderApplication
      parameters:
        - name: imageId
          in: path
          description: The identifier of the image
          required: true
          schema:
            type: string
        - name: senderApplicationId
          in: path
          description: The identifier of the application
          required: true
          schema:
            type: string
      responses:
        200:
          description: "successful operation"
          content:
            application/octet-stream:
              schema:
                type: "string"
                format: "binary"
        401:
          $ref: "#/components/responses/Unauthorized"
        403:
          $ref: "#/components/responses/Forbidden"
        404:
          $ref: "#/components/responses/NotFound"
        default:
          description: "error payload"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      security:
        - Oauth:
            ['scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxresponsible',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseuser',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryuser',
             'scope:document:management:consult:ws-eboxrestentreprise:documentconsumer',
             'scope:document:management:ws-eboxrestentreprise:eboxrepresentativeconsultation']
      x-oauth2-required-scopes: any

  /refData/senderOrganizations:
    get:
      x-ignore-rules:
        "col-repres": Exempt existing arrays to be root json objects
        "rule identifier": "Already like this in the previous minor version. Will be changed for the next major version"
      tags:
        - ReferenceData
      summary: List all senderOrganizations. SenderOrganizations are the different organizations (Institutions, companies...) that send messages to enterprises."
      description: The implementation of this operation is required
      operationId: getAllSenderOrganizations
      responses:
        200:
          description: "successful operation"
          content:
            application/json:
              x-ignore-rules:
                "evo-object": Exempt existing arrays to be root json objects
                "rule identifier": "Already like this in the previous minor version. Will be changed for the next major version"
              schema:
                $ref: "#/components/schemas/SenderOrganizationList"
        401:
          $ref: "#/components/responses/Unauthorized"
        403:
          $ref: "#/components/responses/Forbidden"
        default:
          description: "error payload"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      security:
        - Oauth:
            ['scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxresponsible',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseuser',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryuser',
             'scope:document:management:consult:ws-eboxrestentreprise:documentconsumer',
             'scope:document:management:ws-eboxrestentreprise:eboxrepresentativeconsultation']
      x-oauth2-required-scopes: any

  /refData/senderOrganizations/{senderOrganizationId}:
    get:
      tags:
        - ReferenceData
      summary: Get a senderOrganization by its companyId
      description: ""
      operationId: getSenderOrganizationById
      parameters:
        - name: senderOrganizationId
          in: path
          description: The organizationId of the sender
          required: true
          schema:
            type: string
      responses:
        200:
          description: "successful operation"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SenderOrganization"
        401:
          $ref: "#/components/responses/Unauthorized"
        403:
          $ref: "#/components/responses/Forbidden"
        404:
          $ref: "#/components/responses/NotFound"
        default:
          description: "error payload"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      security:
        - Oauth:
            ['scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxresponsible',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseuser',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryuser',
             'scope:document:management:consult:ws-eboxrestentreprise:documentconsumer',
             'scope:document:management:ws-eboxrestentreprise:eboxrepresentativeconsultation']
      x-oauth2-required-scopes: any

  /refData/senderOrganizations/{senderOrganizationId}/images/{imageId}/content:
    get:
      tags:
        - ReferenceData
      summary: Get an image by its imageId
      description: The implementation of this operation is optional for eBox Enterprise and required for eBox Citizen
      operationId: getImageForSenderOrganization
      parameters:
        - name: imageId
          in: path
          description: The identifier of the image
          required: true
          schema:
            type: string
        - name: senderOrganizationId
          in: path
          description: The identifier of the institution
          required: true
          schema:
            type: string
      responses:
        200:
          description: "successful operation"
          content:
            application/octet-stream:
              schema:
                type: "string"
                format: "binary"
        401:
          $ref: "#/components/responses/Unauthorized"
        403:
          $ref: "#/components/responses/Forbidden"
        404:
          $ref: "#/components/responses/NotFound"
        default:
          description: "error payload"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      security:
        - Oauth:
            ['scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxresponsible',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseuser',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryuser',
             'scope:document:management:consult:ws-eboxrestentreprise:documentconsumer',
             'scope:document:management:ws-eboxrestentreprise:eboxrepresentativeconsultation']
      x-oauth2-required-scopes: any

  /ebox/messages/statistics/nearlyExpired:
    get:
      tags:
        - Statistics
      summary: Number of messages that will expire within some days
      description: Get the number of messages that will expire within the number of days entered as query parameter. The implementation of this operation is required.
      operationId : getStatisticsNearlyExpiredMessages
      parameters:
        - $ref: '#/components/parameters/EnterpriseNumberHeader'
        - name: numberOfDaysBeforeExpiration
          in: query
          description: Filter on messages that will be expired within the number of days entered as value of this parameter.
          required: true
          schema:
            type: integer
            default: 7
        - name: partition
          in: query
          description: Filter on a partition. If not specified, the statistic is counted among every messages that the user has a consultation access to.
          required: false
          schema:
            type: string
        - name: isRead
          in: query
          description: Filter on messages whis the read status provided as parameter. If set to true, it filters on read nearly expired messages. If set to false, it filters on unread nearly expired messages.
          required: false
          schema:
            type: boolean
      responses:
        200:
          description: "successful operation"
          content:
            application/json:
              x-ignore-rules:
                "evo-object": Exempt existing integer to be root json objects
                "rule identifier": "Already like this in the previous minor version. Will be changed for the next major version"
              schema:
                type: integer
        401:
          $ref: "#/components/responses/Unauthorized"
        403:
          $ref: "#/components/responses/Forbidden"
        default:
          description: "error payload"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      security:
        - Oauth:
            ['scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxresponsible',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseuser',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryuser',
             'scope:document:management:consult:ws-eboxrestentreprise:documentconsumer',
             'scope:document:management:ws-eboxrestentreprise:eboxrepresentativeconsultation']
      x-oauth2-required-scopes: any

  /ebox/messages/statistics/withActionRequired:
    get:
      tags:
        - Statistics
      summary: Number of messages which an action from the recipient is requiered.
      description: Get the number of messages which an action from the recipient is requiered. These message have a messageAction of type requiredActionToConfirm in it. This statistic is counted from the messages that the user can consult. The implementation of this operation is optional.
      operationId : getStatisticsMessagesWithActionRequired
      parameters:
        - $ref: '#/components/parameters/EnterpriseNumberHeader'
        - name: partition
          in: query
          description: Filter on a partition. If not specified, the statistic is counted among every messages that the user has a consultation access to.
          required: false
          schema:
            type: string
        - name: isConfirmed
          in: query
          description: Filter on messages where the required action is confirmed. Set it on False to filter on messages where the required action is not confirmed. Set it on True to filter on messages where the action is confirmed. If not specified, no filter on the confirm status is applied.
          required: false
          schema:
            type: boolean
      responses:
        200:
          description: "successful operation"
          content:
            application/json:
              x-ignore-rules:
                "evo-object": Exempt existing arrays to be root json objects
                "rule identifier": "Already like this in the previous minor version. Will be changed for the next major version"
              schema:
                type: integer
        401:
          $ref: "#/components/responses/Unauthorized"
        403:
          $ref: "#/components/responses/Forbidden"
        default:
          description: "error payload"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      security:
        - Oauth:
            ['scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxresponsible',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseuser',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryuser',
             'scope:document:management:consult:ws-eboxrestentreprise:documentconsumer',
             'scope:document:management:ws-eboxrestentreprise:eboxrepresentativeconsultation']
      x-oauth2-required-scopes: any

  /ebox/messages/statistics/registeredMails:
    get:
      tags:
        - Statistics
      summary: Number of registered mails.
      description: Get the number of registered mails and notifications of qualified registered mails. The implementation of this operation is optional.
      operationId : getStatisticsRegisteredMails
      parameters:
        - $ref: '#/components/parameters/EnterpriseNumberHeader'
        - name: partition
          in: query
          description: Filter on a partition. If not specified, the statistic is counted among every messages that the user has a consultation access to.
          required: false
          schema:
            type: string
        - name: isRead
          in: query
          description: Filter on messages where the read status provided as parameter. If set to true, it filters on read registered mails and notifications of qualified registered mails. If set to false, it filters on unread registered mails and notifications of qualified registered mails.
          required: false
          schema:
            type: boolean
      responses:
        200:
          description: "successful operation"
          content:
            application/json:
              x-ignore-rules:
                "evo-object": Exempt existing arrays to be root json objects
                "rule identifier": "Already like this in the previous minor version. Will be changed for the next major version"
              schema:
                type: integer
        401:
          $ref: "#/components/responses/Unauthorized"
        403:
          $ref: "#/components/responses/Forbidden"
        default:
          description: "error payload"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      security:
        - Oauth:
            ['scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryadmin',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxresponsible',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseuser',
             'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryuser',
             'scope:document:management:consult:ws-eboxrestentreprise:documentconsumer',
             'scope:document:management:ws-eboxrestentreprise:eboxrepresentativeconsultation']
      x-oauth2-required-scopes: any

  /ebox/{enterpriseNumber}/publications:
    get:
      tags:
        - Publication
      operationId: getPublications
      summary: Retrieve a list of all sender publications
      parameters:
        - $ref: '#/components/parameters/EnterpriseNumberHeader'
        - $ref: '#/components/parameters/EnterpriseNumberPath'
        - name: publicationId
          in: query
          description: the identifier of a publication
          required: false
          schema:
            type: string
        - name: publicationName
          in: query
          description: the name of a publication
          required: false
          schema:
            type: string
        - name: page
          in: query
          description: The index of the current page of items.
          required: false
          schema:
            type: integer
            default: 1
            minimum: 1
        - name: pageSize
          in: query
          description: The maximal number of results per page.
          required: false
          schema:
            type: integer
            default: 100
            maximum: 1000
            minimum: 1
      responses:
        200:
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PublicationListResponse"
        default:
          description: "error payload"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      security:
        - Oauth:
            ['scope:rsz-onss:administration:ebox-management-rest:admin',
             'scope:document:management:consult:ws-eboxrestentreprise:publicationmandate',
             'scope:document:management:consult:ws-eboxrestentreprise:publicationsender',
             'scope:document:management:ws-eboxrestentreprise:eboxrepresentativepublication']
      x-oauth2-required-scopes: any
    post:
      tags:
        - Publication
      summary: Create a new message publication ready to be sent to several recipients.
      description: "This method does not send a message but it creates a message in order to be send to several recipients with the addRecipients functionality or multicast task. It uses multipart request: one JSON as the message description and one or more attachments. The implementation of this part is optional. The client must be onboarded as a Document Sender in order to have the right to publish. The sum of the attachments size should not exceed 100 MB."
      operationId: createPublication
      parameters:
        - $ref: '#/components/parameters/EnterpriseNumberHeader'
        - $ref: '#/components/parameters/IdempotencyKeyHeader'
        - $ref: '#/components/parameters/EnterpriseNumberPath'
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                messageToPublish:
                  $ref: "#/components/schemas/PublicationCreationRequest"
                upfile1:
                  type: string
                  format: binary
                upfile2:
                  type: string
                  format: binary
                upfile3:
                  type: string
                  format: binary
                upfile4:
                  type: string
                  format: binary
                upfile5:
                  type: string
                  format: binary
                upfile6:
                  type: string
                  format: binary
                upfile7:
                  type: string
                  format: binary
                upfile8:
                  type: string
                  format: binary
                upfile9:
                  type: string
                  format: binary
                upfile10:
                  type: string
                  format: binary
                qrfile:
                  type: string
                  format: binary
              required:
                - messageToPublish
      responses:
        201:
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PublicationCreationResponse"
        400:
          $ref: "#/components/responses/BadRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        403:
          $ref: "#/components/responses/Forbidden"
        404:
          $ref: "#/components/responses/NotFound"
        default:
          description: "error payload"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      security:
        - Oauth:
            ['scope:rsz-onss:administration:ebox-management-rest:admin',
             'scope:document:management:consult:ws-eboxrestentreprise:publicationmandate',
             'scope:document:management:consult:ws-eboxrestentreprise:publicationsender',
             'scope:document:management:ws-eboxrestentreprise:eboxrepresentativepublication']
      x-oauth2-required-scopes: any

  /ebox/{enterpriseNumber}/publications/{publicationId}/addRecipients:
    post:
      tags:
        - Publication
      summary: Send a publication to new recipients synchronously
      description: Link a message to a list of recipients (broadcast publication) thus the recipient receives the same message in their e-Box. The messageId must have been published by the same sender. If you wish to have a very large number of recipients, the operation multicastTasks is advised instead of addRecipients. The implementation of this operation is optional.
      operationId: publishMessageToRecipients
      parameters:
        - $ref: '#/components/parameters/EnterpriseNumberHeader'
        - $ref: '#/components/parameters/IdempotencyKeyHeader'
        - $ref: '#/components/parameters/EnterpriseNumberPath'
        - name: publicationId
          in: path
          description: The identifier of the publication
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PublicationToLinkRequest"
        description: The PublicationToLink contains all recipients to reach
      responses:
        201:
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PublicationToLinkResponse"
        400:
          $ref: "#/components/responses/BadRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        403:
          $ref: "#/components/responses/Forbidden"
        404:
          $ref: "#/components/responses/NotFound"
        default:
          description: "error payload"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      security:
        - Oauth:
            ['scope:rsz-onss:administration:ebox-management-rest:admin',
             'scope:document:management:consult:ws-eboxrestentreprise:publicationmandate',
             'scope:document:management:consult:ws-eboxrestentreprise:publicationsender',
             'scope:document:management:ws-eboxrestentreprise:eboxrepresentativepublication']
      x-oauth2-required-scopes: any
  /ebox/{enterpriseNumber}/publications/{publicationId}/multicastTasks:
    post:
      tags:
        - Publication
      summary: Request an asynchronous publication of a message to multiple recipients
      description: "This endpoint can be used to send a publication to a large number of recipients providing a CSV file as a list of recipients. This request is asynchronous and you may use the /multicastTasks/{multicastTaskId} endpoint to check the progression of the request. The separator must be comma. The implementation of this part is optional"
      operationId: postMultiCast
      parameters:
        - $ref: '#/components/parameters/EnterpriseNumberHeader'
        - $ref: '#/components/parameters/IdempotencyKeyHeader'
        - $ref: '#/components/parameters/EnterpriseNumberPath'
        - name: publicationId
          in: path
          description: The identifier of the publication
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                recipientsCsv:
                  type: string
                  format: binary
                  description: a CSV file containing all recipients the message must be sent to.
              required:
                - recipientsCsv
            encoding:
              recipientsCsv:
                contentType: text/csv

      responses:
        202:
          description: Task accepted and running
          headers:
            Location:
              description: URL of the created task.
              schema:
                type: string
        400:
          $ref: "#/components/responses/BadRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        403:
          $ref: "#/components/responses/Forbidden"
        404:
          $ref: "#/components/responses/NotFound"
        409:
          $ref: "#/components/responses/Conflict"
        default:
          description: "error payload"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      security:
        - Oauth:
            ['scope:rsz-onss:administration:ebox-management-rest:admin',
             'scope:document:management:consult:ws-eboxrestentreprise:publicationmandate',
             'scope:document:management:consult:ws-eboxrestentreprise:publicationsender',
             'scope:document:management:ws-eboxrestentreprise:eboxrepresentativepublication']
      x-oauth2-required-scopes: any

  /ebox/{enterpriseNumber}/multicastTasks:
    get:
      tags:
        - Publication
      summary: Get a list of tasks
      description: Retrieve a list of tasks with their name, recipient count, status, and creation date. The multicastTasks are creatd with the POST /publications/{publicationId}/multicastTasks method.
      operationId: getTasks
      parameters:
        - $ref: '#/components/parameters/EnterpriseNumberHeader'
        - $ref: '#/components/parameters/EnterpriseNumberPath'
        - name: page
          in: query
          description: The index of the current page of items.
          required: false
          schema:
            type: integer
            default: 1
            minimum: 1
        - name: pageSize
          in: query
          description: The maximal number of results per page.
          required: false
          schema:
            type: integer
            default: 25
            maximum: 100
            minimum: 1
        - name: publicationId
          in: query
          description: The publication id linked to the multiTask
          required: false
          schema:
            type: string
        - name: state
          in: query
          description: The state of a task
          required: false
          schema:
            $ref: "#/components/schemas/MulticastTaskState"
      responses:
        '200':
          description: Successful response with task details.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TasksResponse"
        '401':
          $ref: "#/components/responses/Unauthorized"
        '403':
          $ref: "#/components/responses/Forbidden"
        '404':
          $ref: "#/components/responses/NotFound"
        default:
          description: "error payload"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      security:
        - Oauth:
            ['scope:rsz-onss:administration:ebox-management-rest:admin',
             'scope:document:management:consult:ws-eboxrestentreprise:publicationmandate',
             'scope:document:management:consult:ws-eboxrestentreprise:publicationsender',
             'scope:document:management:ws-eboxrestentreprise:eboxrepresentativepublication']
      x-oauth2-required-scopes: any

  /ebox/{enterpriseNumber}/multicastTasks/{multicastTaskId}:
    get:
      operationId: getTaskStatus
      tags:
        - Publication
      summary: Get the status of a task
      description: "Get the status of a task previously created with the endpoint POST /publications/{publicationId}/multicastTasks."
      parameters:
        - $ref: '#/components/parameters/EnterpriseNumberHeader'
        - $ref: '#/components/parameters/EnterpriseNumberPath'
        - name: multicastTaskId
          in: path
          required: true
          description: The ID of the task.
          schema:
            type: string
      responses:
        '200':
          description: Successful response with task details.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TaskStatusResponse"
        401:
          $ref: "#/components/responses/Unauthorized"
        403:
          $ref: "#/components/responses/Forbidden"
        404:
          $ref: "#/components/responses/NotFound"
        default:
          description: "error payload"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      security:
        - Oauth:
            ['scope:rsz-onss:administration:ebox-management-rest:admin',
             'scope:document:management:consult:ws-eboxrestentreprise:publicationmandate',
             'scope:document:management:consult:ws-eboxrestentreprise:publicationsender',
             'scope:document:management:ws-eboxrestentreprise:eboxrepresentativepublication']
      x-oauth2-required-scopes: any

  /ebox/{enterpriseNumber}/multicastTasks/{multicastTaskId}/messagePublicationStatuses:
    get:
      operationId: getTaskMessagesPublicationStatuses
      tags:
        - Publication
      summary: Get the status of messages to send in a multicast task
      description: Retrieve the current state for each message to send in a multicast task. The list is paginated unless a CSV is requested. For CSV format, the pagination parameters are ignored.
      parameters:
        - $ref: '#/components/parameters/EnterpriseNumberHeader'
        - $ref: '#/components/parameters/EnterpriseNumberPath'
        - name: multicastTaskId
          in: path
          required: true
          description: The ID of the task.
          schema:
            type: string
        - name: page
          in: query
          description: The index of the current page of items.
          required: false
          schema:
            type: integer
            default: 1
            minimum: 1
        - name: pageSize
          in: query
          description: The maximal number of results per page.
          required: false
          schema:
            type: integer
            default: 100
            maximum: 1000
            minimum: 1
        - name: state
          in: query
          description: The state of a sending
          required: false
          schema:
            $ref: "#/components/schemas/MulticastTaskState"
        - name: recipientSsin
          in: query
          description: The target ssin
          required: false
          schema:
            $ref: "#/components/schemas/Ssin"
        - name: recipientEnterpriseNumber
          in: query
          description: The target enterpriseNumber
          required: false
          schema:
            $ref: "#/components/schemas/EnterpriseNumber"
      responses:
        200:
          description: Successful response with task details.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MessagePublicationStatusesResponse"
            text/csv:
              schema:
                type: string
                format: binary
        401:
          $ref: "#/components/responses/Unauthorized"
        403:
          $ref: "#/components/responses/Forbidden"
        404:
          $ref: "#/components/responses/NotFound"
        406:
          description: Unsupported media type (Not Acceptable)
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
        default:
          description: "error payload"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      security:
        - Oauth:
            ['scope:rsz-onss:administration:ebox-management-rest:admin',
             'scope:document:management:consult:ws-eboxrestentreprise:publicationmandate',
             'scope:document:management:consult:ws-eboxrestentreprise:publicationsender',
             'scope:document:management:ws-eboxrestentreprise:eboxrepresentativepublication']
      x-oauth2-required-scopes: any

  /ebox/messages/{messageId}/link:
    post:
      deprecated: true
      tags:
        - Publication
      summary: Link a message to other recipients
      description: This method is deprecated. You should use the POST /publications and POST /publications/{publicationId}/addRecipients or POST /publications/{publicationId}/multicastTasks instead. This method links a message to a list of recipients (broadcast publication) thus the recipient receives the same message in their e-Box. The messageId must have been published by the same sender. The implementation of this operation is optional
      operationId: linkMessage
      parameters:
        - name: messageId
          in: path
          description: The identifier of the message
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/MessageToLink"
        description: The MessageToLink contains the messageId and the list of recipients.
      responses:
        201:
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/LinkMessageResponse"
        400:
          $ref: "#/components/responses/BadRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        403:
          $ref: "#/components/responses/Forbidden"
        404:
          $ref: "#/components/responses/NotFound"
        default:
          description: "error payload"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      security:
        - Oauth:
            ['scope:document:management:consult:ws-eboxrestentreprise:publicationmandate']
      x-oauth2-required-scopes: any

  /ebox/messages/consultStatuses:
    post:
      tags:
        - Publication
      summary: Get a status for a list of published messages
      description: Allows Document Senders to get a status about the message they have sent. The data is only available for Document Senders who sent the messages. The implementation of this operation is optional.
      operationId: getMessageStatus
      parameters:
        - $ref: '#/components/parameters/EnterpriseNumberHeader'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ConsultStatuses"
      responses:
        200:
          description: successful operation
          content:
            application/json:
              x-ignore-rules:
                "evo-object": Exempt existing arrays to be root json objects
                "rule identifier": "Already like this in the previous minor version. Will be changed for the next major version"
              schema:
                $ref: "#/components/schemas/MessageStatusList"
        400:
          $ref: "#/components/responses/BadRequest"
        401:
          $ref: "#/components/responses/Unauthorized"
        403:
          $ref: "#/components/responses/Forbidden"
        404:
          $ref: "#/components/responses/NotFound"
        default:
          description: "error payload"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      security:
        - Oauth:
            ['scope:document:management:consult:ws-eboxrestentreprise:publicationmandate',
             'scope:document:management:consult:ws-eboxrestentreprise:publicationsender',
             'scope:document:management:consult:ws-eboxrestentreprise:publicationweb',
             'scope:document:management:ws-eboxrestentreprise:eboxrepresentativepublication']
      x-oauth2-required-scopes: any

  /eventNotifications:
    post:
      tags:
        - Webhooks
      summary: Receive a notification through a cloud event based body
      description: "The eventNotification web service will call this method whenever a data change about partitions, access right on partitions or routing rules. A data change can be a creation, update or a deletion. This method concerns only Document Providers and Document Providers must implement this method. See more on the e-Box development documentation to get the schema for each notification type."
      operationId: receiveEventNotification
      requestBody:
        required: true
        content:
          application/cloudevents+json:
            schema:
              $ref: '#/components/schemas/DocumentProviderNotificationEvent'
            examples:
              routingRuleDeleted:
                $ref: '#/components/examples/RoutingRuleDeleted'
              routingRuleCreated:
                $ref: '#/components/examples/RoutingRuleCreated'
              routingRuleUpdated:
                $ref: '#/components/examples/RoutingRuleUpdated'
              partitionCreated:
                $ref: '#/components/examples/PartitionCreated'
              partitionDeleted:
                $ref: '#/components/examples/PartitionDeleted'
              userPartitionRightsAdded:
                $ref: '#/components/examples/UserPartitionRightsAdded'
              userPartitionRightsRemoved:
                $ref: '#/components/examples/UserPartitionRightsRemoved'
      responses:
        204:
          description: successful operation
        default:
          description: "error payload"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      security:
        - Oauth:
            ['scope:document:management:consult:ws-eboxrestentreprise:eventnotification:push']
      x-oauth2-required-scopes: any
  /health:
    get:
      tags:
        - Monitoring
      summary: Check health of the service
      description: This resource is only available to supervision users
      operationId: checkHealth
      externalDocs:
        url: "https://www.belgif.be/specification/rest/api-guide/#health"
      responses:
        "200":
          description: The service is UP, DEGRADED, DOWN
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HealthStatus"
              examples:
                responseUp:
                  value:
                    {
                      "status": "UP"
                    }
                responseDegraded:
                  value:
                    {
                      "status": "DEGRADED"
                    }
        "503":
          description: The Service is unavailable
        default:
          description: "error payload"
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/Problem"
      security:
        - Oauth:
            [ 'scope:document:management:consult:ws-eboxrestentreprise:monitoring' ]


components:
  examples:
    UserPartitionRightsAdded:
      value:
        specversion: "1.0"
        id: "550e8400-e29b-41d4-a716-446655440003"
        subject: "0677932208"
        time: "2025-03-25T14:00:00Z"
        dataschema: "https://dev.eboxenterprise.be/docs/spec/specifications#event-notification"
        source: "documentmanagement:publication:eboxenterprise:client:public"
        type: "be.eboxenterprise.v1.userPartitionRights.rightAdded"
        datacontenttype: "application/json"
        data:
          enterpriseNumber: "0406798006"
          partitionId: "HRdepartment"
          userSsin: "44022722580"
    UserPartitionRightsRemoved:
      value:
        specversion: "1.0"
        id: "550e8400-e29b-41d4-a716-446655440003"
        subject: "0677932208"
        time: "2025-03-25T14:00:00Z"
        dataschema: "https://dev.eboxenterprise.be/docs/spec/specifications#event-notification"
        source: "documentmanagement:publication:eboxenterprise:client:public"
        type: "be.eboxenterprise.v1.userPartitionRights.rightRemoved"
        datacontenttype: "application/json"
        data:
          enterpriseNumber: "0406798006"
          partitionId: "HRdepartment"
          userSsin: "44022722580"
    UserPartitionRightsCreated:
      value:
        specversion: "1.0"
        id: "550e8400-e29b-41d4-a716-446655440003"
        subject: "0677932208"
        time: "2025-03-25T14:00:00Z"
        dataschema: "https://dev.eboxenterprise.be/docs/spec/specifications#event-notification"
        source: "documentmanagement:publication:eboxenterprise:client:public"
        type: "be.eboxenterprise.v1.userPartitionRights.rightAdded"
        datacontenttype: "application/json"
        data:
          enterpriseNumber: "0406798006"
          partitionId: "HRdepartment"
          userSsin: "44022722580"

    PartitionCreated:
      value:
        specversion: "1.0"
        id: "550e8400-e29b-41d4-a716-446655440002"
        subject: "0677932208"
        time: "2025-03-25T14:00:00Z"
        dataschema: "https://dev.eboxenterprise.be/docs/spec/specifications#event-notification"
        source: "documentmanagement:publication:eboxenterprise:client:public"
        type: "be.eboxenterprise.v1.partition.created"
        datacontenttype: "application/json"
        data:
          enterpriseNumber: "0406798006"
          partitionId: "HRdepartment"
    PartitionDeleted:
      value:
        specversion: "1.0"
        id: "550e8400-e29b-41d4-a716-446655440002"
        subject: "0677932208"
        time: "2025-03-25T14:00:00Z"
        dataschema: "https://dev.eboxenterprise.be/docs/spec/specifications#event-notification"
        source: "documentmanagement:publication:eboxenterprise:client:public"
        type: "be.eboxenterprise.v1.partition.deleted"
        datacontenttype: "application/json"
        data:
          enterpriseNumber: "0406798006"
          partitionId: "HRdepartment"
    RoutingRuleCreated:
      value:
        specversion: "1.0"
        id: "550e8400-e29b-41d4-a716-446655440001"
        subject: "0677932208"
        time: "2025-03-25T14:00:00Z"
        dataschema: "https://dev.eboxenterprise.be/docs/spec/specifications#event-notification"
        source: "documentmanagement:publication:eboxenterprise:client:public"
        type: "be.eboxenterprise.v1.routingRule.created"
        datacontenttype: "application/json"
        data:
          enterpriseNumber: "0406798006"
          routingRuleId: 123
          orderedRoutingRules:
            items:
              - routingRuleId: 123
                priority: 1
                conditions:
                  - messageTypeId: "MT123"
                    senderApplicationId: "APP001"
                    senderOrganizationId: "0123456789"
                targetPartitionId: "finance"
                creationDate: "2025-07-18T10:00:00Z"
    RoutingRuleDeleted:
      value:
        specversion: "1.0"
        id: "550e8400-e29b-41d4-a716-446655440001"
        subject: "0677932208"
        time: "2025-03-25T14:00:00Z"
        dataschema: "https://dev.eboxenterprise.be/docs/spec/specifications#event-notification"
        source: "documentmanagement:publication:eboxenterprise:client:public"
        type: "be.eboxenterprise.v1.routingRule.deleted"
        datacontenttype: "application/json"
        data:
          enterpriseNumber: "0406798006"
          routingRuleId: 123
          orderedRoutingRules:
            items:
              - routingRuleId: 123
                priority: 1
                conditions:
                  - messageTypeId: "MT123"
                    senderApplicationId: "APP001"
                    senderOrganizationId: "0123456789"
                targetPartitionId: "finance"
                creationDate: "2025-07-18T10:00:00Z"
    RoutingRuleUpdated:
      value:
        specversion: "1.0"
        id: "550e8400-e29b-41d4-a716-446655440001"
        subject: "0677932208"
        time: "2025-03-25T14:00:00Z"
        dataschema: "https://dev.eboxenterprise.be/docs/spec/specifications#event-notification"
        source: "documentmanagement:publication:eboxenterprise:client:public"
        type: "be.eboxenterprise.v1.routingRule.updated"
        datacontenttype: "application/json"
        data:
          enterpriseNumber: "0406798006"
          routingRuleId: 123
          orderedRoutingRules:
            items:
              - routingRuleId: 123
                priority: 1
                conditions:
                  - messageTypeId: "MT123"
                    senderApplicationId: "APP001"
                    senderOrganizationId: "0123456789"
                targetPartitionId: "finance"
                creationDate: "2025-07-18T10:00:00Z"

  securitySchemes:
    Oauth:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: 'https://services-int.socialsecurity.be/REST/oauth/v5/authorize'
          tokenUrl: 'https://privateservices-int.socialsecurity.be/REST/oauth/v5/token'
          scopes:
            'scope:document:management:consult:ws-eboxrestentreprise:eboxresponsible': "This scope allows the RAE/co-RAE to consult their messages in e-Box Enterprise. They can do all the operations under Messages, ReferenceData, Statistics and Reply."
            'scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseadmin': "This scope allows the GL/co-GL under the qualities QUAL_COMPANY, QUAL_EMP_NOSS, QUAL_EMP_NOSSPLA to consult their messages in e-Box Enterprise. They can do all the operations under Messages, ReferenceData, Statistics and Reply."
            'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryadmin': "This scope allows the GL/co-GL under the qualities  QUAL_SSC, QUAL_FSC, QUAL_SP_LEG to consult their messages in e-Box Enterprise. They can do all the operations under Messages, ReferenceData, Statistics and Reply."
            'scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseuser': "This scope allows the user under the qualities QUAL_COMPANY, QUAL_EMP_NOSS, QUAL_EMP_NOSSPLA to consult their messages in e-Box Enterprise.They can do all the operations under Messages, ReferenceData, Statistics and Reply."
            'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryuser': "This scope allows the user under the qualities QUAL_SSC, QUAL_FSC, QUAL_SP_LEG to consult their messages in e-Box Enterprise. They can do all the operations under Messages, ReferenceData, Statistics and Reply."
            'scope:document:management:consult:ws-eboxrestentreprise:publicationweb': "This scope allows institutions to publish a message via the interface e-Box Enterprise. They can do the operation POST /ebox/messages under Publication"
            'scope:document:management:consult:ws-eboxrestentreprise:documentconsumer': "This scope allows the Document Consumers of e-Box Enterprise to consult their messages directly via the current RESTful webservice. They can do all the operations under Messages, ReferenceData, Statistics and Reply."
            'scope:document:management:consult:ws-eboxrestentreprise:publicationmandate': "This scope allows the Document Senders to publish messages in the name of whichever institution. They can do all the operations under Publication."
            'scope:document:management:consult:ws-eboxrestentreprise:publicationsender': "This scope allows the Document Senders to publish messages in the name of their own institution.They can do all the operations under Publication."
            'scope:document:management:ws-eboxrestentreprise:eboxrepresentativepublication': "This scope allows mandated Document Sender representatives to publish on behalf of their client. They can do all the operations under Publication and should include the On-Behalf-Of-Enterprise-Number header."
            'scope:document:management:ws-eboxrestentreprise:eboxrepresentativeconsultation': "This scope allows mandated Document Consumer representatives to consult the e-Box of their client. They can do all the operations under Messages, ReferenceData, Statistics and Reply. They have to include On-Behalf-Of-Enterprise-Number header."
            'scope:document:management:consult:ws-eboxrestentreprise:eventnotification:push': "This scope must be accepted in order to be notified by the eventNotification web service."
            'scope:rsz-onss:administration:ebox-management-rest:admin': "This scope is given only to e-Box support teams"
            'scope:document:management:consult:ws-eboxrestentreprise:monitoring': "Ths scope allows calling the /health endpoint"

        clientCredentials:
          tokenUrl: 'https://privateservices-int.socialsecurity.be/REST/oauth/v5/token'
          scopes:
            'scope:document:management:consult:ws-eboxrestentreprise:eboxresponsible': "This scope allows the RAE/co-RAE to consult their messages in e-Box Enterprise. They can do all the operations under Messages, ReferenceData, Statistics and Reply."
            'scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseadmin': "This scope allows the GL/co-GL under the qualities QUAL_COMPANY, QUAL_EMP_NOSS, QUAL_EMP_NOSSPLA to consult their messages in e-Box Enterprise. They can do all the operations under Messages, ReferenceData, Statistics and Reply."
            'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryadmin': "This scope allows the GL/co-GL under the qualities  QUAL_SSC, QUAL_FSC, QUAL_SP_LEG to consult their messages in e-Box Enterprise. They can do all the operations under Messages, ReferenceData, Statistics and Reply."
            'scope:document:management:consult:ws-eboxrestentreprise:eboxenterpriseuser': "This scope allows the user under the qualities QUAL_COMPANY, QUAL_EMP_NOSS, QUAL_EMP_NOSSPLA to consult their messages in e-Box Enterprise.They can do all the operations under Messages, ReferenceData, Statistics and Reply."
            'scope:document:management:consult:ws-eboxrestentreprise:eboxmandataryuser': "This scope allows the user under the qualities QUAL_SSC, QUAL_FSC, QUAL_SP_LEG to consult their messages in e-Box Enterprise. They can do all the operations under Messages, ReferenceData, Statistics and Reply."
            'scope:document:management:consult:ws-eboxrestentreprise:publicationweb': "This scope allows institutions to publish a message via the interface e-Box Enterprise. They can do the operation POST /ebox/messages under Publication"
            'scope:document:management:consult:ws-eboxrestentreprise:documentconsumer': "This scope allows the Document Consumers of e-Box Enterprise to consult their messages directly via the current RESTful webservice. They can do all the operations under Messages, ReferenceData, Statistics and Reply."
            'scope:document:management:consult:ws-eboxrestentreprise:publicationmandate': "This scope allows the Document Senders to publish messages in the name of whichever institution. They can do all the operations under Publication."
            'scope:document:management:consult:ws-eboxrestentreprise:publicationsender': "This scope allows the Document Senders to publish messages in the name of their own institution.They can do all the operations under Publication."
            'scope:document:management:ws-eboxrestentreprise:eboxrepresentativepublication': "This scope allows mandated Document Sender representatives to publish on behalf of their client. They can do all the operations under Publication and should include the On-Behalf-Of-Enterprise-Number header."
            'scope:document:management:ws-eboxrestentreprise:eboxrepresentativeconsultation': "This scope allows mandated Document Consumer representatives to consult the e-Box of their client. They can do all the operations under Messages, ReferenceData, Statistics and Reply. They have to include On-Behalf-Of-Enterprise-Number header."
            'scope:document:management:consult:ws-eboxrestentreprise:eventnotification:push': "This scope must be accepted in order to be notified by the eventNotification web service."
            'scope:rsz-onss:administration:ebox-management-rest:admin': "This scope is given only to e-Box support teams"
            'scope:document:management:consult:ws-eboxrestentreprise:monitoring': "Ths scope allows calling the /health endpoint"

  parameters:
    IdempotencyKeyHeader:
      name: Idempotency-Key
      in: header
      description: "A unique Idempotency-Key can be used to identify an unique request. A second attempt would be considered as a duplicate, ending up in HTTP response code 409 Conflict."
      schema:
        type: string
    EnterpriseNumberHeader:
      name: On-Behalf-Of-Enterprise-Number
      in: header
      description: "If the client is a technical intermediary of another organization, this header must be used in order to identify for which organization the user is performing requests. A mandate must be signed in order to accept the request."
      schema:
        type: string
        pattern: '^[0-1]\d{9}$'
        example: "0870288651"
    EnterpriseNumberPath:
      name: enterpriseNumber
      in: path
      required: true
      description: target enteprirse number
      schema:
        type: string
        pattern: '^[0-1]\d{9}$'
        example: "0870288651"
  schemas:
    Address:
      type: object
      properties:
        streetName:
          type: string
          description: Street name
        buildingNumber:
          type: string
          description: The locator designator. It is the concatenation of House Number and Box Number (alphanumerical format)
        city:
          type: string
          description: City name
        postCode:
          type: string
          description: Postal Code
        countryIsoCode:
          description: Country represented by an ISO 3166-1 alpha-2 code
          type: string
          pattern: "^[A-Z]{2}$"

    Attachment:
      description: An attachment item contains all the metadata of an attachment and the link to the attachtment content itself
      type: object
      required:
        - attachmentId
        - fileName
        - isMainContent
        - mediaType
        - size
      properties:
        attachmentId:
          type: string
          description: Unique identifier of the attachment
        attachmentTitle:
          $ref: "#/components/schemas/LocalizedString"
        fileName:
          type: string
          description: The file name provided by the sender, with its extension
          example: yourDocument.pdf
        isMainContent:
          type: boolean
          description: "Indicates the priority of this attachment: 'true' means that this attachment is considered as main content of the message, 'false' means this attachment is considered as an annex. Attention, the readStatus of a message will be true as soon as a 'mainContent' is consulted."
        mediaType:
          $ref: "#/components/schemas/MediaType"
        size:
          type: number
          format: double
          example: 1800.123
          description: Size of the attachment, expressed in kB
        digest:
          $ref: "#/components/schemas/Digest"
        isAttachmentSigned:
          type: boolean
          description: Boolean used to indicate if the attachment is signed or not.
          default: false
        contentHref:
          type: string
          format: uri
          description: URL to the content of the attachment

    AttachmentToPublish:
      description: An attachment item contains the meta data of the attachment
      type: object
      required:
        - isMainContent
      oneOf:
        - required: [httpPartName]
        - required: [documentReference]
      properties:
        attachmentTitle:
          $ref: "#/components/schemas/LocalizedString"
        httpPartName:
          type: string
          description: the name of the http part that contain the bytes, filename and mime type of the document. The http part name should have ASCII characters only.
        isMainContent:
          type: boolean
          description: "Indicates the priority of this attachment: 'true' means that this attachment is considered as main content of the message, 'false' means this attachment is considered as an annex. Please note that the readStatus of a message will be true as soon as a 'mainContent' is consulted."
        digest:
          $ref: "#/components/schemas/Digest"
        isAttachmentSigned:
          type: boolean
          description: Boolean used to indicate if the attachment is signed or not.
          default: false
        documentReference:
          $ref: "#/components/schemas/DocumentReference"

    BelgianRemittanceInformationStructured:
      description: Structured Remittance Information in the Belgian OGM-VCS format
      type: string
      pattern: "^\\d{12}$"
      # Often formatted for display as +++ 3 digits / 4 digits / 5 digits / +++ (example: +++010/8068/17183+++)
      # The last 2 digits are check digits (modulo 97) of the first 10 digits, but if the result is 0, then the check digits are 97

    Beneficiary:
      type: object
      required:
        - name
      properties:
        name:
          type: string
          description: Beneficiary Name
        address:
          $ref: "#/components/schemas/Address"

    Bic:
      description: Business Identifier Code, also known as Swift Code. International identifier for financial and non-financial institutions, commonly used for international bank transfers.
      type: string
      pattern: '^[A-Z]{4}[A-Z]{2}[A-Z0-9]{2}([A-Z0-9]{3})?$'
      # consists of:
      #   institution code (4 letters)
      #   country code (2 letters - ISO 3166-1 alpha-2)
      #   location code (2 alphanumeric characters)
      #   optional branch code (3 alphanumeric characters)

    BusinessData:
      type: object
      description: A businessData element contains business data concerning the message linked to it, in the form of a name, an optional description and an array of values.
      properties:
        key:
          type: string
          description: Significative key of the businessData element.
          example: FOLDER_NUMBER
        name:
          $ref: "#/components/schemas/LocalizedString"
        description:
          $ref: "#/components/schemas/LocalizedString"
        values:
          description: Values represented by the businessData.
          type: array
          items:
            $ref: "#/components/schemas/LocalizedString"
      required:
        - key
        - name
        - values

    BusinessDataToPublish:
      type: object
      description: A businessData element contains businessData concerning the message linked to it, in the form of a name and an array of values. To publish a BusinessData element, at least a key and an array of values is needed.
      properties:
        key:
          type: string
          description: Significative key of the businessData element
          example: FOLDER_NUMBER
        name:
          $ref: "#/components/schemas/LocalizedString"
        description:
          $ref: "#/components/schemas/LocalizedString"
        values:
          description: Values represented by the businessData.
          type: array
          items:
            $ref: "#/components/schemas/LocalizedString"
      required:
        - key
        - values

    ChangePartition:
      type: object
      properties:
        messageIds:
          description: List of message identifiers
          type: array
          items:
            type: string
          minItems: 1
        sourcePartitionId:
          description: Mutually exclusive with messageIds. If a sourcePartitionId is defined, every messages from this partition will be moved if the user has a consultation right on it. The properties messageIds and sourcePartitionId cannot be set in the same request.
          type: string
          example: "partitionToDelete"
        targetRecipientPartitionId:
          description: Identifier of the the partition where to move the messages to. The partition cannot be in another e-Box than the recipient's e-Box. The client must be part of the recipient enterprise.
          type: string
          example: "HRpartition"
        targetSenderPartitionId:
          description: Partition identifier to change the sender partition of the message. The operation is available for user that has a consultation right on the source partition.
          type: string
          example: "newSenderPartition"

    ChangeVisibility:
      type: object
      required:
        - messageIds
        - isVisible
      properties:
        messageIds:
          description: List of message identifiers
          type: array
          items:
            type: string
          minItems: 1
        isVisible:
          description: Set to false to hide the messages. Set to true to unhide them.
          type: boolean
    CloudEventBase: # extend this schema with allOf to define schemas for specific events, with constraints on data/data_base64 and type
      type: object
      properties:
        specversion:
          type: string
          minLength: 1
          description: The version of the CloudEvents specification which the event uses.
          example: "1.0"
        id:
          type: string
          minLength: 1
          description: Identifies the event. Producers MUST ensure that source + id is unique for each distinct event. If a duplicate event is re-sent (e.g. due to a network error) it MAY have the same id. Consumers MAY assume that Events with identical source and id are duplicates.
          example: "550e8400-e29b-41d4-a716-446655440000"
        source:
          type: string
          format: uri-reference
          minLength: 1
          description: >
            Identifies the context in which an event happened.<br>
            Often this will include information such as the type of the event source, the organization publishing the event or the process that produced the event. The exact syntax and semantics behind the data encoded in the URI is defined by the event producer.<br>
            
            Producers MUST ensure that source + id is unique for each distinct event.<br>
            
            An application MAY assign a unique source to each distinct producer, which makes it
            easy to produce unique IDs since no other producer will have the same source.
            The application MAY use UUIDs, URNs, DNS authorities or an application-specific
            scheme to create unique source identifiers.<br>
            
            An absolute URI is RECOMMENDED
          example: "urn:event-source:nsso:employer-register"
        datacontenttype:
          type: string
          minLength: 1
          description: Media type of the payload (values of data or data_base64).
            MUST adhere to the format specified in RFC 2046.
          default: "application/json"
          nullable: true
          x-ignore-rules:
            jsn-null: allow null to comply with CloudEvents 1.0 spec
        subject:
          type: string
          minLength: 1
          description: Subject of the event (optional, may also be only present in payload)
          example: "employer:123456"
          nullable: true
          x-ignore-rules:
            jsn-null: allow null to comply with CloudEvents 1.0 spec
        time:
          type: string
          format: date-time
          description: Timestamp of when the occurrence happened. If the time of the occurrence cannot be determined then this attribute MAY be set to some other time (such as the current time) by the CloudEvents producer, however all producers for the same source MUST be consistent in this respect. In other words, either they all use the actual time of the occurrence or they all use the same algorithm to determine the value used.
          nullable: true
          x-ignore-rules:
            jsn-null: allow null to comply with CloudEvents 1.0 spec
        dataschema:
          description: Identifies the schema that data adheres to. Incompatible changes to the schema SHOULD be reflected by a different URI.
          type: string
          minLength: 1
          nullable: true
          format: uri
          x-ignore-rules:
            jsn-null: allow null to comply with CloudEvents 1.0 spec
      required: [id, specversion, source]
    ConsultStatuses:
      type: object
      properties:
        messageIds:
          type: array
          description: List of message identifiers. The client must be part of the organization that sent the messages.
          items:
            type: string
          minItems: 1
          maxItems: 500

    Digest:
      type: object
      required:
        - digestMethod
        - digestValue
      properties:
        digestValue:
          type: string
          description: "Digest value returned by the cryptographic hash function encoded in base64url as defined in [RFC 4648 section 5](https://tools.ietf.org/html/rfc4648#section-5)"
        digestMethod:
          x-ignore-rules:
            "cod-design": Exempt enum to be lowerCamelCase
            "rule identifier": "Already like this in the previous minor version. Will be changed for the next major version"
          type: string
          description: Cryptographic hash function used to obtain the digest
          enum:
            - sha_256
      description: Object containing the digestValue and digestMethod describing the cryptographic hash function of an item.
    DocumentProviderNotificationEvent:
      type: object
      allOf:
        - $ref: "#/components/schemas/CloudEventBase"
      properties:
        type:
          type: string
          minLength: 1
      required: [type]
      discriminator:
        propertyName: type
        mapping:
          "be.eboxenterprise.v1.routingRule.created": RoutingRuleEventCreated
          "be.eboxenterprise.v1.routingRule.updated": RoutingRuleEventUpdated
          "be.eboxenterprise.v1.routingRule.deleted": RoutingRuleEventDeleted
          "be.eboxenterprise.v1.partition.created": PartitionEventCreated
          "be.eboxenterprise.v1.partition.deleted": PartitionEventDeleted
          "be.eboxenterprise.v1.userPartitionRights.rightAdded": UserPartitionRightsEventAdded
          "be.eboxenterprise.v1.userPartitionRights.rightRemoved": UserPartitionRightsEventRemoved
    DocumentReference:
      description: "This object allows to send a reference to the document instead of including the document content as a HTTP part in the request. The reference can be an URI or a document ID depending on what is supported by the Document Provider. If a documentReference is given, then property httpPartName must not be provided."
      type: object
      required:
        - reference
        - mediaType
        - fileName
      properties:
        reference:
          description: A reference to the external file in a document repository.
          type: string
        mediaType:
          $ref: "#/components/schemas/MediaType"
        fileName:
          type: string
          description: The download file name with its extension.
          example: yourDocument.pdf
    DeprecatedEnterpriseNumber:
      deprecated: true
      type: string
      pattern: '^[0-1]\d{9}$'
      example: "0870288651"
      description: "Identifier issued by CBE for a registered organization"
    EnterpriseNumber:
      type: string
      pattern: '^[0-1]\d{9}$'
      example: "0870288651"
      description: "Identifier issued by CBE for a registered organization"
    RecipientEboxId:
      description: Common type defined to provide a recipient or a sender. The properties ssin and enterpriseNumber are mutually exclusive. If the e-Box type is enterprise then the enterpriseNumber is required to identify the e-Box. If the e-Box type is citizen then the ssin is required to identify the e-Box.
      type: object
      required:
        - eboxType
      properties:
        eboxType:
          $ref: "#/components/schemas/EboxType"
        ssin:
          $ref: "#/components/schemas/Ssin"
        enterpriseNumber:
          $ref: "#/components/schemas/EnterpriseNumber"
        partition:
          type: string
          description: An ebox partition.
          example: secretariat
          deprecated: true
    SenderEboxIdOnlyPartition:
      description: Identification of the sender partition with support of deprecated fields
      type: object
      properties:
        eboxType:
          $ref: "#/components/schemas/DeprecatedEboxType"
        enterpriseNumber:
          $ref: "#/components/schemas/DeprecatedEnterpriseNumber"
        partition:
          type: string
          description: An ebox partition.
          example: secretariat
    EboxId:
      description: Common type defined to provide a recipient or a sender. The properties ssin and enterpriseNumber are mutually exclusive. If the e-Box type is enterprise then the enterpriseNumber is required to identify the e-Box. If the e-Box type is citizen then the ssin is required to identify the e-Box.
      type: object
      required:
        - eboxType
      properties:
        eboxType:
          $ref: "#/components/schemas/EboxType"
        ssin:
          $ref: "#/components/schemas/Ssin"
        enterpriseNumber:
          $ref: "#/components/schemas/EnterpriseNumber"
        partition:
          type: string
          description: An ebox partition.
          example: secretariat
    EboxIdError:
      description: List of messageIds by recipient.
      allOf:
        - $ref: "#/components/schemas/EboxId"
        - type: object
          properties:
            errorMessage:
              type: string
            ssin:
              description: Social Security Identification Number issued by the National Register or CBSS
              type: string
            enterpriseNumber:
              type: string
              example: "0870288651"
              description: "Identifier issued by CBE for a registered organization"
    DeprecatedEboxType:
      deprecated: true
      type: string
      enum:
        - enterprise
        - citizen
    EboxType:
      type: string
      enum:
        - enterprise
        - citizen
    ForTheAttentionOf:
      type: object
      description: Indication when the message is for the attention of a specific person, identified by the Social Security Identification Number of this person.
      properties:
        ssin:
          $ref: "#/components/schemas/Ssin"
        label:
          description: The name that will be displayed in the recipient's e-Box
          type: string
          example: "M. surname name"
      required:
        - label
    HealthStatus:
      description: Response message for the API health
      type: object
      properties:
        status:
          description: "Level indicating the health status of the service: UP (functioning as expected), DOWN (suffering unexpected failures), DEGRADED (partly unavailable but service can be continued with reduced functionality), or a custom status value"
          type: string
      required:
        - status

    Iban:
      description: 'International Bank Account Number, as defined in ISO 13616:2007'
      type: string
      pattern: '^[A-Z]{2}[0-9]{2}[A-Z0-9]{1,30}$'
      example: "BE12345678901234"
      # consists of:
      #   country code (two letters - ISO 3166-1 alpha-2)
      #   two check digits
      #   up to 30 alphanumeric characters that are country-specific

    Image:
      description: metadata about an image or a logo.
      type: object
      required:
        - imageId
        - size
        - mediaType
        - contentHref
      properties:
        imageId:
          type: string
          description: Identifier of the image
        size:
          type: number
          format: double
          example: 1800.0
          description: Size of the image, expressed in kB
        mediaType:
          x-ignore-rules:
            "cod-design": Exempt enum to be lowerCamelCase
            "rule identifier": "Already like this in the previous minor version. Will be changed for the next major version"
          type: string
          description: Format of the image following RFC2046
          enum:
            - "image/jpg"
            - "image/jpeg"
            - "image/png"
            - "image/gif"
            - "image/svg+xml"
        contentHref:
          description: URL of the image content.
          type: string
          format: uri

    MessagePublicationStatusesResponse:
      type: object
      properties:
        state:
          $ref: "#/components/schemas/MulticastTaskState"
        errorMessage:
          type: string
          description: error message if the state is `error`
        pollAfter:
          type: string
          format: date-time
          description: When to poll again for `processing` state.
        completed:
          type: string
          format: date-time
          description: When the task was completed for `done` state.
        sender:
          $ref: "#/components/schemas/EboxId"
        actor:
          $ref: "#/components/schemas/EboxId"
        items:
          type: array
          items:
            $ref: "#/components/schemas/MessagePublicationStatus"
        pageSize:
          type: integer
          description: Number of items per page.
        page:
          type: integer
          description: Current page number.
        total:
          type: integer
          description: Total number of tasks available.
        first:
          type: string
          description: URL of the first page.
        last:
          type: string
          description: URL of the last page.
        prev:
          type: string
          description: URL of the previous page, if applicable.
        next:
          type: string
          description: URL of the next page, if applicable.

    PublicationToLinkResponse:
      description: Object returned after a publication to multiple recipients
      type: object
      properties:
        nbSuccessLinks:
          type: integer
          description: Number of successful links as result of a /linkEboxMessage request.
          example: 150
        successCases:
          type: array
          items:
            $ref: "#/components/schemas/PublicationStatusMessage"
        errorCases:
          description: List of recipients not receiving the message because of an error.
          type: array
          items:
            $ref: "#/components/schemas/EboxIdError"
    LinkMessageResponse:
      description: Object returned after a linkEboxMessage request
      type: object
      properties:
        linkMessages:
          type: array
          items:
            $ref: "#/components/schemas/LinkMessage"
        messageId:
          type: string
          description: Unique identifier of the linked message
        expirationDate:
          type: string
          format: date-time
          description: Date-time (yyyy-MM-dd'T'HH:mm:ssXXX) when the message will expire in the ebox.
        nbSuccessLinks:
          type: integer
          description: Number of successful links as result of a /linkEboxMessage request.
          example: 150
        errorCases:
          description: List of recipients not receiving the message because of an error.
          type: array
          items:
            $ref: "#/components/schemas/EboxIdError"
    LinkMessage:
      description: List of messageIds by recipient.
      type: object
      required:
        - messageId
        - recipient
        - expirationDate
      properties:
        messageId:
          type: string
          description: Unique identifier of the linked message
        recipient:
          $ref: "#/components/schemas/EboxId"
        expirationDate:
          type: string
          format: date-time
          description: Date-time (yyyy-MM-dd'T'HH:mm:ssXXX) when the message will expire in the ebox.


    LocalizedLogo:
      description: "Common type defined to provide a logo for each supported language among nl, fr, de. You can do a request GET ``/referenceData/senderApplications/{senderApplicationId}/images/{imageId}/content`` or GET ``/referenceData/senderOrganizations/{senderOrganizationId}/images/{imageId}/content`` to load a logo content."
      properties:
        nl:
          $ref: "#/components/schemas/Image"
        fr:
          $ref: "#/components/schemas/Image"
        de:
          $ref: "#/components/schemas/Image"

    LocalizedString:
      description: Common type defined to provide a string value for each supported language among nl, fr, de
      type: object
      properties:
        nl:
          type: string
        fr:
          type: string
        de:
          type: string

    MediaType:
      x-ignore-rules:
        "cod-design": Exempt enum to be lowerCamelCase
        "rule identifier": "Already like this in the previous minor version. Will be changed for the next major version"
      type: string
      description: Standardized identifier for file formats following RFC2046
      enum:
        - "application/pdf"
        - "application/zip"
        - "application/xml"
        - "text/csv"
        - "text/html"
        - "text/plain"
        - "text/xml"
        - "application/vnd.oasis.opendocument.text"
        - "application/vnd.oasis.opendocument.spreadsheet"
        - "application/vnd.oasis.opendocument.presentation"
        - "application/vnd.oasis.opendocument.graphics"
        - "application/vnd.ms-excel"
        - "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
        - "application/vnd.ms-powerpoint"
        - "application/msword"
        - "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
        - "image/png"
        - "image/jpeg"
      example: "application/pdf"

    Message:
      description: A message is basically composed of a set of metadata (e.g. subject, receipt date, read status, etc.), one or more attachments and optionnaly a body or payment data.
      type: object
      required:
        - messageId
        - subject
        - sender
        - senderApplicationId
        - recipient
        - messageTypeId
        - receiptDate
        - expirationDate
        - isRead
      properties:
        messageId:
          type: string
          description: Unique identifier of the message in the ebox. We suggest to make it unique to all ebox to avoid problems for the sent-box.
        subject:
          $ref: "#/components/schemas/LocalizedString"
        sender:
          $ref: "#/components/schemas/EboxId"
        senderApplicationId:
          type: "string"
          description: Identifier of the senderApplication
        recipient:
          $ref: "#/components/schemas/EboxId"
        messageTypeId:
          type: "string"
          description: Identifier of a messageType
        receiptDate:
          type: string
          format: date-time
          description: Date-time (yyyy-MM-dd'T'HH:mm:ssXXX) when the message was received in the ebox.
          example: "2022-12-19T00:00:00+01:00"
        expirationDate:
          type: string
          format: date-time
          description: Date-time (yyyy-MM-dd'T'HH:mm:ssXXX) when the message will expire in the ebox.
          example: "2025-12-19T00:00:00+01:00"
        isRead:
          type: boolean
          description: Indicates whether or not the message has already been read. A message is marked as read if the main content is consulted. If the main content is an attachment, then it is considered consulted if the content is downloaded.
          default: false
        firstReadDate:
          type: string
          format: date-time
          description: Date-time (yyyy-MM-dd'T'HH:mm:ssXXX) when the message is read.
          example: "2024-12-19T00:00:00+01:00"
        isVisible:
          type: boolean
          description: Indication whether or not the message is visible or not.
          default: true
        isRegisteredMail:
          type: boolean
          deprecated: true
          description: Indicates whether or not the message was published as a registered mail in the ebox. Pay attention that a juridical law is written about electronic registered mail and contains criteria to follow in order to publish a message with the same juridical value than a postal registered mail. DO NOT put this boolean at true if the message does not follow the criteria.
          default: false
        registeredMailType:
          $ref: "#/components/schemas/RegisteredMailType"
        forTheAttentionOf:
          $ref: "#/components/schemas/ForTheAttentionOf"
        isReplyAuthorized:
          type: boolean
          description: "Indicate if the message allows replies. If there is a message action of type replyWithTemplate for the message then the reply must follow the template of one of the message action. If there is not, then a reply can be sent without following any template."
          default: false
        parentMessageId:
          type: string
          description: In case of a reply, the parentMessageId is the identifier of the replied message.
        originalMessageId:
          type: string
          description: External id of the published message. Can be used as a correlation id defined by the sender.
        replyDueDate:
          type: string
          format: date-time
          description: "Date-time (yyyy-MM-dd'T'HH:mm:ssXXX) until when the reply is possible. This property can not be set if the isReplyAuthorized is false. The reply due date must be before the expiration date."
          example: "2025-01-01T00:00:00+01:00"
        isReplied:
          type: boolean
          description: Indication whether or not the message has a reply.
          default: false
        lastReplyDate:
          type: string
          format: date-time
          description: Date-time (yyyy-MM-dd'T'HH:mm:ssXXX) when the message was replied in the ebox. Only present when reply=true
          example: "2023-09-01T00:00:00+01:00"
        attachments:
          description: Documents attached to the messages.
          type: array
          items:
            $ref: "#/components/schemas/Attachment"
        hasBody:
          type: boolean
          description: Indication whether or not the message has a bodyContent. The body content can be consulted by doing the request GET ``/ebox/messages/{messageId}/body``.
          default: false
        isBodyMainContent:
          type: boolean
          description: "This property must be present only if there is a body. Indicates the priority of the bodyContent: 'true' means that the body is considered as main content of the message, 'false' means it is considered as an annex. Attention, the readStatus of a message will be true as soon as a 'mainContent' is consulted."
          default: false
        hasStructuredData:
          type: boolean
          description: "Indication whether or not the message has message data. The MessageData structure exists to convey information that should not be displayed to the endUser. It can be used for machine to machine processing. The messageData can be consulted by doing the request GET ``/ebox/messages/{messageId}/structuredData``."
          default: false
        hasMessageActions:
          type: boolean
          description: "Indication whether or not the message has one or several message actions. The message actions with their status can be consulted by doing the request GET ``/ebox/messages/{messageId}/messageActions``. Then the message action can be consulted by doing the request GET ``/messageActions/{messageActionId}`` with the IDs retrieved from previous request."
          default: false
        hasPaymentData:
          type: boolean
          description: "Indication whether or not the message has paymentData. The payment data can be consulted by doit the request GET ``/ebox/messages/{messageId}/paymentData``."
          default: false
        hasNotifications:
          type: boolean
          description: "Indication whether or not the message has notificiations. The payment data can be consulted by doit the request GET ``/ebox/messages/{messageId}/notifications``."
          default: false
        businessDataList:
          type: array
          description: A businessData element is a meta data linked to the message content that can be displayed to the recipient and its value is also taken into account for the message search feature.
          items:
            $ref: "#/components/schemas/BusinessData"

    MessageAction:
      type: object
      description: "A possible action on a message. The possible action depends on the ``type`` property.\n- replyWithTemplate : A reply on the message is possible but following the template which identifier is the value of the ``messageTemplateId`` property. You can call a GET ``/messageTemplates/{messageTemplateId}`` request to load the template and then reply on the message specifying the ``messageTemplateId`` in the request.\n- replyWithExternalForm : An external form can be completed. The link to the form is the value of the ``url`` property. Once the form is completed, the PATCH ``/ebox/messages/{messageId}/messageActions/{messageActionId}`` request can be sent to inform that the form is completed.\n- requiredActionToConfirm : The recipient is required to complete an action. The action description should be written in the body or the main document in the message. Once the recipient completed the required action, the recipient do a manual operation that do a PATCH ``/ebox/messages/{messageId}/messageActions/{messageActionId}`` request. The same request can be made by the recipient to remove the confirmation."
      required:
        - messageActionId
        - label
        - description
        - type
      properties:
        messageActionId:
          type: string
          description: not human readable, generated by the Document Provider
        label:
          $ref: "#/components/schemas/LocalizedString"
        description:
          $ref: "#/components/schemas/LocalizedString"
        type:
          type: string
          description: "messageAction Type. The possible values are replyWithTemplate,  replyWithExternalForm or requiredActionToConfirm."
        url:
          $ref: "#/components/schemas/LocalizedString"
        messageTemplateId:
          type: string
          description: "Message template identifier. This field is required if the messageAction type is replyWithTemplate. You can get the template by doing a GET /messageTemplates/{messageTemplateId} request."

    MessageActionStatus:
      type: object
      description: Object containing the execution status of a given MessageAction related to a given Message
      required:
        - messageActionId
        - isExecuted
      properties:
        messageActionId:
          type: string
          description: the identifier of the MessageAction
        isExecuted:
          type: boolean
          description: indication whether or not the MessageAction was executed for the Message to which this MessageActionStatus is linked
          default: false
        lastExecutionDate:
          type: string
          format: date-time
          description: the last time this action was executed for the Message to which this MessageActionStatus is linked
        executionDueDate:
          type: string
          format: date-time
          description: Add a due date for the action.
          example: "2025-01-01T00:00:00+01:00"
    MessageActionStatusList:
      type: array
      items:
        $ref: "#/components/schemas/MessageActionStatus"


    MessageActionStatusToPatch:
      type: object
      description: Data on a message action status that can be patched.
      properties:
        isExecuted:
          type: boolean
          description: indication whether or not the MessageAction was executed for the Message to which this MessageActionStatus is linked

    MessageActionToPublish:
      type: object
      description: Object to add a possible action to a message for the recipient and its due date. See the MessageAction description for info about existing message action types.
      required:
        - messageActionId
      properties:
        messageActionId:
          type: string
          description: the identifier of the MessageAction
        executionDueDate:
          type: string
          format: date-time
          description: Add a due date for the action.
          example: "2025-01-01T00:00:00+01:00"

    Messages:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: "#/components/schemas/Message"
        totalItems:
          description: This field is a required field for supporting a correct HIP Integration.
          type: integer
      description: A paged list of messages. Messages are the main elements contained in an ebox. A message is basically composed of a set of metadata (e.g. subject, receipt date, etc.) and the content, being one body and/or one or more attachments.

    MessageStatus:
      type: object
      required:
        - messageId
        - recipient
        - expirationDate
        - isRead
        - isVisible
      properties:
        messageId:
          type: string
          description: Unique identifier of the message in the ebox.
        recipient:
          $ref: "#/components/schemas/RecipientEboxId"
        expirationDate:
          type: string
          format: date-time
          description: Date-time (yyyy-MM-dd'T'HH:mm:ssXXX) when the message will expire in the ebox.
          example: "2025-01-01T00:00:00+01:00"
        firstReadDate:
          type: string
          format: date-time
          description: Date-time (yyyy-MM-dd'T'HH:mm:ssXXX) when the message is read.
          example: "2024-12-19T00:00:00+01:00"
        isRead:
          type: boolean
          description: Indicates whether or not the main content of the message has already been opened.
          default: false
        isVisible:
          type: boolean
          description: Indication whether or not the message is visible or not.
          default: true

    MessagePublicationStatus:
      type: object
      description: the status of a message to be sent
      properties:
        state:
          $ref: "#/components/schemas/MulticastTaskState"
        recipient:
          $ref: "#/components/schemas/EboxIdError"
        messageId:
          type: string
          description: The message ID.
        expirationDate:
          type: string
          format: date-time
          description: Add a due date for the action.
          example: "2025-01-01T00:00:00+01:00"
        errorMessage:
          type: string
          description: The error that occurred while sending the message if any

    MessageStatusList:
      type: array
      items:
        $ref: "#/components/schemas/MessageStatus"

    MessageTemplate:
      description: A message template describe how a message can be replied.
      type: object
      required:
        - messageTemplateId
        - editable
      properties:
        messageTemplateId:
          type: string
          description: Unique identifier of the message template.
        editable:
          type: object
          description: Describe which message elements are editable.
          properties:
            isBodyEditable:
              type: boolean
              description: Describe if the bodyContent is editable.
            isSubjectEditable:
              type: boolean
              description: Describe if the subject is editable.
            isStructuredDataEditable:
              type: boolean
              description: Describe if the data is editable.
            isAttachmentsEditable:
              type: boolean
              description: Describe if the attachments is editable.
        messagePrototype:
          type: object
          properties:
            isReplyAuthorized:
              type: boolean
              description: if true, then the reply following the template can be replied too.
            messageTypeId:
              type: string
              description: Identifier of a messageType
            forTheAttentionOf:
              $ref: "#/components/schemas/ForTheAttentionOf"
            subject:
              $ref: "#/components/schemas/LocalizedString"
            bodyContent:
              $ref: "#/components/schemas/LocalizedString"
            structuredData:
              description: The MessageData structure exists to convey information that SHOULD NOT be displayed to the endUser. This is in contrast with BusinessData structure which SHOULD be displayed as is to the endUser.
              type: string
    PublicationToLinkRequest:
      description: Object to send a message to more recipients.
      type: object
      required:
        - recipients
      properties:
        recipients:
          description: The other recipients that should receive the message to link.
          type: array
          items :
            $ref: "#/components/schemas/RecipientEboxId"
          minItems: 1
          maxItems: 100

    MessageToLink:
      description: Object to link a message to other recipients.
      type: object
      required:
        - recipients
      properties:
        recipients:
          description: The other recipients that should receive the message to link.
          type: array
          items :
            $ref: "#/components/schemas/EboxId"
    PublicationListResponse:
      type: object
      description: list of sender publications
      properties:
        pageSize:
          type: integer
          description: Number of items per page.
        page:
          type: integer
          description: Current page number.
        total:
          type: integer
          description: Total number of tasks available.
        first:
          type: string
          description: URL of the first page.
        last:
          type: string
          description: URL of the last page.
        prev:
          type: string
          description: URL of the previous page, if applicable.
        next:
          type: string
          description: URL of the next page, if applicable.
        items:
          type: array
          items:
            $ref: "#/components/schemas/PublicationViewResponse"
    PublicationCreationRequest:
      type: object
      description: A publicationCreationRequest is basically composed of a mandatory set of metadata
        (e.g. subject, messageTypeId, etc.); optional attachment(s)
        and/or body, with at least one main content. The attachments should not exceed 100 MB.
      required:
        - targetEboxType
        - sender
        - senderApplicationId
        - messageTypeId
        - subject
      properties:
        publicationName:
          type: string
        targetEboxType:
          $ref: "#/components/schemas/EboxType"
        sender:
          $ref: "#/components/schemas/EboxId"
        senderApplicationId:
          type: string
          description: Identifier of the senderApplication
        subject:
          $ref: "#/components/schemas/LocalizedString"
        messageTypeId:
          type: string
          description: Identifier of a messageType
        expirationDate:
          type: string
          format: date-time
          description: Date-time (yyyy-MM-dd'T'HH:mm:ssXXX) when the message will expire in
            the ebox.
          example: "2025-01-01T00:00:00+01:00"
        isRegisteredMail:
          type: boolean
          deprecated: true
          description: Indicates whether or not the message was published as a registered mail in the ebox. Pay attention that a juridical law is written about electronic registered mail and contains criteria to follow in order to publish a message with the same juridical value than a postal registered mail. DO NOT put this boolean at true if the message does not follow the criteria.
        registeredMailType:
          allOf:
            - $ref: "#/components/schemas/RegisteredMailType"
            - default: "notApplicable"
        originalMessageId:
          type: string
          description: External id of the published message. Can be used as a correlation id defined by the sender.
        attachments:
          type: array
          description: A list of attachments
          maxItems: 10
          items:
            $ref: "#/components/schemas/AttachmentToPublish"
        bodyContent:
          $ref: "#/components/schemas/LocalizedString"
        isBodyMainContent:
          type: boolean
          description: "This property must be present only if there is a body. Indicates the priority of the bodyContent: true means that the body is considered as main content of the message, 'false' means it is considered as an annex. The readStatus of a message will be true as soon as a 'mainContent' is consulted."
          default: false
        businessDataList:
          type: array
          description: List of business data
          items:
            $ref: "#/components/schemas/BusinessDataToPublish"
        isReplyAuthorized:
          type: boolean
          description: Indicate if the message allows replies. If there is a message action of type replyWithTemplate for the message then the reply must follow the template of one of the message action. If there is not, then a reply can be sent without following any template.
          default: false
        replyDueDate:
          type: string
          format: date-time
          description: Date-time (yyyy-MM-dd'T'HH:mm:ssXXX) until when the reply is
            possible.
          example: "2024-01-01T00:00:00+01:00"
        messageActions:
          type: array
          description: "Array of message actions available for the recipient. Only one of type *requiredActionToConfirm* can be in this array."
          items:
            $ref: "#/components/schemas/MessageActionToPublish"
        paymentData:
          $ref: "#/components/schemas/PaymentDataToPublish"
        forTheAttentionOf:
          $ref: "#/components/schemas/ForTheAttentionOf"
        structuredData:
          description: The MessageData structure exists to convey information that SHOULD NOT be displayed to the endUser. This is in contrast with BusinessData structure which SHOULD be displayed as is to the endUser.
          type: string
        notifications:
          $ref: "#/components/schemas/Notifications"

    MessageToPublish:
      type: object
      description: A messageToPublish is basically composed of a mandatory set of metadata
        (e.g. recipient, subject, messageTypeId, etc.); optional attachment(s)
        and/or body, with at least one main content. The attachments should not exceed 100 MB.
      required:
        - recipient
        - senderApplicationId
        - messageTypeId
        - subject
      properties:
        recipient:
          $ref: "#/components/schemas/RecipientEboxId"
        sender:
          $ref: "#/components/schemas/SenderEboxIdOnlyPartition"
        senderApplicationId:
          type: string
          description: Identifier of the senderApplication
        subject:
          $ref: "#/components/schemas/LocalizedString"
        messageTypeId:
          type: string
          description: Identifier of a messageType
        expirationDate:
          type: string
          format: date-time
          description: Date-time (yyyy-MM-dd'T'HH:mm:ssXXX) when the message will expire in
            the ebox.
          example: "2025-01-01T00:00:00+01:00"
        isRegisteredMail:
          type: boolean
          deprecated: true
          description: Indicates whether or not the message was published as a registered mail in the ebox. Pay attention that a juridical law is written about electronic registered mail and contains criteria to follow in order to publish a message with the same juridical value than a postal registered mail. DO NOT put this boolean at true if the message does not follow the criteria.
        registeredMailType:
          allOf:
            - $ref: "#/components/schemas/RegisteredMailType"
            - default: "notApplicable"
        originalMessageId:
          type: string
          description: External id of the published message. Can be used as a correlation id defined by the sender.
        attachments:
          type: array
          description: A list of attachments
          maxItems: 10
          items:
            $ref: "#/components/schemas/AttachmentToPublish"
        bodyContent:
          $ref: "#/components/schemas/LocalizedString"
        isBodyMainContent:
          type: boolean
          description: "This property must be present only if there is a body. Indicates the priority of the bodyContent: true means that the body is considered as main content of the message, 'false' means it is considered as an annex. The readStatus of a message will be true as soon as a 'mainContent' is consulted."
          default: false
        businessDataList:
          type: array
          description: List of business data
          items:
            $ref: "#/components/schemas/BusinessDataToPublish"
        isReplyAuthorized:
          type: boolean
          description: Indicate if the message allows replies. If there is a message action of type replyWithTemplate for the message then the reply must follow the template of one of the message action. If there is not, then a reply can be sent without following any template.
          default: false
        replyDueDate:
          type: string
          format: date-time
          description: Date-time (yyyy-MM-dd'T'HH:mm:ssXXX) until when the reply is
            possible.
          example: "2024-01-01T00:00:00+01:00"
        messageActions:
          type: array
          description: "Array of message actions available for the recipient. Only one of type *requiredActionToConfirm* can be in this array."
          items:
            $ref: "#/components/schemas/MessageActionToPublish"
        paymentData:
          $ref: "#/components/schemas/PaymentDataToPublish"
        forTheAttentionOf:
          $ref: "#/components/schemas/ForTheAttentionOf"
        structuredData:
          description: The MessageData structure exists to convey information that SHOULD NOT be displayed to the endUser. This is in contrast with BusinessData structure which SHOULD be displayed as is to the endUser.
          type: string
        notifications:
          $ref: "#/components/schemas/Notifications"
    Notifications:
      type: object
      description: "A list of notification"
      required:
        - items
      properties:
        items:
          type: array
          items:
            $ref: "#/components/schemas/Notification"
    Notification:
      type: object
      properties:
        type:
          type: string
          description: The Notification type
          enum:
            - forcedNewDocumentReminder
        days:
          type: integer
          minimum: 1
          maximum: 30

    MessageToReply:
      type: object
      required:
        - sender
      properties:
        messageActionId:
          type: string
          description: The identifier of the action that was used to reply
        messageTemplateId:
          type: string
          description: The identifier of the message template that was used to write the reply message.
        sender:
          $ref: "#/components/schemas/EboxId"
        bodyContent:
          $ref: "#/components/schemas/LocalizedString"
        structuredData:
          description: The MessageData structure exists to convey information that SHOULD NOT be displayed to the endUser. This is in contrast with BusinessData structure which SHOULD be displayed as is to the endUser.
          type: string
        attachments:
          type: array
          description: A list of attachments. The attachments should not exceed 100 MB for enterprise, 8MB for citize. Max is 3 attachments for citizen.
          maxItems: 10
          items:
            $ref: "#/components/schemas/AttachmentToPublish"

    MessageType:
      description: A MessageType corresponds to a business category of a letter or document (e.g. attestation X., declaration Y., communication Z., etc.).
      type: object
      required:
        - id
        - name
      properties:
        id:
          type: string
          description: Identifier of a messageType
        name:
          $ref: "#/components/schemas/LocalizedString"
        description:
          $ref: "#/components/schemas/LocalizedString"
        validityPeriod:
          description: Validity period of the messageType, indicating when messages of this type expire and are no longer available.
          type: object
          required:
            - validityPeriodNumber
            - validityPeriodUnit
          properties:
            validityPeriodNumber:
              type: integer
              description: Number of validityPeriodUnits
            validityPeriodUnit:
              type: string
              description: Period unit used for the definition of the validationPeriod
              enum:
                - day
                - month
                - year

    MessageTypeList:
      type: array
      items:
        $ref: "#/components/schemas/MessageType"

    MonetaryValue:
      description: The numerical part of a monetary amount in decimal notation. Negative values are allowed. Only two digits after decimal is accepted.
      type: string   # string conserves decimal precision
      format: number # number is a custom string format that is supported by some, but not all tooling
      pattern: '^(\-|\+)?((\d+(\.\d*)?)|(\.\d+))$'  # Variable number of digits, with at least one digit required, before or after the decimal point. Allows both positive and negative values.
      example: "100.23"

    PaymentData:
      description: Data concerning payments
      type: object
      required:
        - paymentDataId
        - totalAmount
        - iban
        - beneficiary
      properties:
        paymentDataId:
          type: string
          description: Identifier of the paymentData
        totalAmount:
          # Amount that needs to be paid, vat included. Only two digits after the dot are accepted.
          $ref: "#/components/schemas/MonetaryValue"
        amount:
          # Amount without vat included. Only two digits after the dot are accepted.
          $ref: "#/components/schemas/MonetaryValue"
        vatAmount:
          # Amount of the vat, to be added to the base amount when applicable. Only two digits after the dot are accepted.
          $ref: "#/components/schemas/MonetaryValue"
        currency:
          description: A currency represented by its ISO 4217 alpha code
          type: string
          pattern: "^[A-Z]{3}$"
          default: EUR
        iban:
          $ref: "#/components/schemas/Iban"
        bic:
          $ref: "#/components/schemas/Bic"
        dueDate:
          type: string
          format: date-time
          description: "Date on which the payment needs to be fulfilled (yyyy-MM-dd'T'HH:mm:ssXXX)"
          example: "2024-01-01T00:00:00+01:00"
        beneficiary:
          $ref: "#/components/schemas/Beneficiary"
        remittanceInformationStructured:
          $ref: "#/components/schemas/BelgianRemittanceInformationStructured"
        qrCode:
          $ref: "#/components/schemas/QrCode"

    PaymentDataToPublish:
      type: object
      required:
        - totalAmount
        - iban
        - beneficiary
      properties:
        totalAmount:
          # Amount that needs to be paid, vat included. Only two digits after the dot are accepted.
          $ref: "#/components/schemas/MonetaryValue"
        amount:
          # Amount without vat included. Only two digits after the dot are accepted.
          $ref: "#/components/schemas/MonetaryValue"
        vatAmount:
          # Amount of the vat, to be added to the base amount when applicable. Only two digits after the dot are accepted.
          $ref: "#/components/schemas/MonetaryValue"
        currency:
          description: A currency represented by its ISO 4217 alpha code
          type: string
          pattern: "^[A-Z]{3}$"
          default: EUR
        iban:
          $ref: "#/components/schemas/Iban"
        bic:
          $ref: "#/components/schemas/Bic"
        dueDate:
          type: string
          format: date-time
          description: "Date on which the payment needs to be fulfilled (yyyy-MM-dd'T'HH:mm:ssXXX)"
          example: "2024-01-01T00:00:00+01:00"
        beneficiary:
          $ref: "#/components/schemas/Beneficiary"
        remittanceInformationStructured:
          $ref: "#/components/schemas/BelgianRemittanceInformationStructured"
        qrCode:
          $ref: "#/components/schemas/QrCodeToPublish"

    Problem:
      description: A Problem Details object (RFC 7807)
      type: object
      properties:
        type:
          type: string
          format: uri
          description: An absolute URI that identifies the problem type
        href:
          type: string
          format: uri
          description: An absolute URI that, when dereferenced, provides human-readable documentation for the problem type (e.g. using HTML).
        title:
          type: string
          description: A short summary of the problem type. Written in English and readable for engineers (usually not suited for non technical stakeholders and not localized).
          example: Service Unavailable
        status:
          type: integer
          format: int32
          description: The HTTP status code generated by the origin server for this occurrence of the problem.
          minimum: 400
          maximum: 600
          exclusiveMaximum: true # "If you have an error here, you are probably using the wrong JSON Schema specification or the unstable version editor-next.swagger.io . See https://github.com/belgif/openapi-problem/issues/11"
          example: 503
        detail:
          type: string
          description: A human-readable explanation specific to this occurrence of the problem
        instance:
          type: string
          format: uri
          description: An absolute URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced.

    PublicationCreationResponse:
      type: object
      required:
        - publicationId
        - expirationDate
      properties:
        publicationId:
          type: string
          description: Unique identifier of the message publication in the sender ebox. This identifier can be used to add recipients to this publication
        expirationDate:
          type: string
          format: date-time
          description: Date-time (yyyy-MM-dd'T'HH:mm:ssXXX) when the message will expire in
            the ebox.
          example: "2025-12-19T00:00:00+01:00"
        code:
          type: string
          description: Business Code
        message:
          type: string
          description: Business Code Description

    PublicationStatusMessage:
      type: object
      required:
        - messageId
        - expirationDate
      properties:
        recipient:
          $ref: "#/components/schemas/RecipientEboxId"
        messageId:
          type: string
          description: Unique identifier of the message in the ebox. We suggest to make it
            unique to all ebox to avoid problems for the sent-box.
        expirationDate:
          type: string
          format: date-time
          description: Date-time (yyyy-MM-dd'T'HH:mm:ssXXX) when the message will expire in
            the ebox.
          example: "2025-12-19T00:00:00+01:00"
        code:
          type: string
          description: Business Code
        message:
          type: string
          description: Business Code Description

    QrCode:
      type: object
      required:
        - type
        - mediaType
        - data
      properties:
        data:
          type: string
          description: QR Code data deeplink
        type:
          type: string
          description: QR Code type
        mediaType:
          x-ignore-rules:
            "cod-design": Exempt enum to be lowerCamelCase
            "rule identifier": "Already like this in the previous minor version. Will be changed for the next major version"
          type: string
          description: QR Code Image Media Type
          enum:
            - image/jpg
            - image/jpeg
            - image/png
            - image/svg+xml

    QrCodeToPublish:
      type: object
      required:
        - type
        - data
        - httpPartName
      properties:
        data:
          type: string
          description: QR Code data deeplink
        type:
          type: string
          description: QR Code type
        httpPartName:
          type: string
          description: QR Image as HttpPart (mediaType infered)

    RegisteredMailType:
      description: Indicate whether the message is a registered mail, notification of a qualified registered mail, qualified registered mail, or 'notApplicable' for other non-registered messages. The term 'qualifed' is a qualification defined by the legal standards of EREQ (norme ISO)
      type: string
      enum:
        - 'nonQualifiedRegisteredMail'
        - 'qualifiedRegisteredMailNotification'
        - 'notApplicable'
      x-enum-varnames:
        - 'NON_QUALIFIED_REGISTERED_MAIL'
        - 'QUALIFIED_REGISTERED_MAIL_NOTIFICATION'
        - 'NOT_APPLICABLE'

    ReplyStatusMessage:
      type: object
      required:
        - messageId
        - expirationDate
      properties:
        messageId:
          type: string
          description: Unique identifier of the message in the ebox. We suggest to make it unique to all ebox to avoid problems for the sent-box.
        expirationDate:
          type: string
          format: date-time
          description: Date-time (yyyy-MM-dd'T'HH:mm:ssXXX) when the message will expire in
            the ebox.

    SenderApplication:
      description: Information about an application that publish messages
      type: object
      required:
        - id
        - name
      properties:
        id:
          type: string
          description: Identifier of the senderApplication
        name:
          $ref: "#/components/schemas/LocalizedString"
        description:
          $ref: "#/components/schemas/LocalizedString"
        logo:
          $ref: "#/components/schemas/LocalizedLogo"
        url:
          # URL that can lead the end user in case of the end user needs help about the content of a message sent by the application. An URL can be set for each language.
          $ref: "#/components/schemas/LocalizedString"

    SenderApplicationList:
      type: array
      items:
        $ref: "#/components/schemas/SenderApplication"

    SenderOrganization:
      description: SenderOrganization represents an organization (institution, company...) that can publish messages.
      type: object
      required:
        - enterpriseNumber
        - name
      properties:
        enterpriseNumber:
          $ref: "#/components/schemas/EnterpriseNumber"
        name:
          $ref: "#/components/schemas/LocalizedString"
        description:
          $ref: "#/components/schemas/LocalizedString"
        logo:
          $ref: "#/components/schemas/LocalizedLogo"
        url:
          # URL of the organisation. It can be used in case of the end user needs support about the content of a message.
          $ref: "#/components/schemas/LocalizedString"

    SenderOrganizationList:
      type: array
      items:
        $ref: "#/components/schemas/SenderOrganization"

    PublicationViewResponse:
      description: detail of a sender publication
      type: object
      properties:
        publicationId:
          type: string
        publicationName:
          type: string
        targetEboxType:
          $ref: "#/components/schemas/EboxType"
        expirationDate:
          type: string
          format: date-time
          description: Date-time (yyyy-MM-dd'T'HH:mm:ssXXX) when the message will expire in
            the ebox.
          example: "2025-01-01T00:00:00+01:00"

    TasksResponse:
      description: Successful response with a list of tasks.
      type: object
      properties:
        self:
          type: string
          description: URL of the current page.
          example: "/multicastTasks?page=2"
        items:
          type: array
          items:
            type: object
            properties:
              publicationId:
                type: string
                description: the identifier of the root publication
              multicastTaskId:
                type: number
                description: the technical id
              taskName:
                type: string
                description: The name of the task.
              recipientCount:
                type: integer
                description: The number of recipients for the task.
              state:
                $ref: "#/components/schemas/MulticastTaskState"
              errorMessage:
                type: string
                description: error message if the state is `error`
              createdAt:
                type: string
                format: date-time
                description: The creation date of the task.
                example: "2024-02-14T09:30:00Z"
              sender:
                $ref: "#/components/schemas/EboxId"
              actor:
                $ref: "#/components/schemas/EboxId"
        pageSize:
          type: integer
          description: Number of items per page.
          minimum: 1
          example: 25
        page:
          type: integer
          description: Current page number.
          minimum: 1
        total:
          type: integer
          description: Total number of tasks available.
        first:
          type: string
          description: URL of the first page.
          example: "/multicastTasks?page=1"
        last:
          type: string
          description: URL of the last page.
          example: "/multicastTasks?page=3"
        prev:
          type: string
          description: URL of the previous page, if applicable.
          example: "/multicastTasks?page=1"
        next:
          type: string
          description: URL of the next page, if applicable.
          example: "/multicastTasks?page=3"

    TaskStatusResponse:
      type: object
      properties:
        status:
          type: object
          properties:
            state:
              $ref: "#/components/schemas/MulticastTaskState"
            errorMessage:
              type: string
              description: error message if the state is `error`
            pollAfter:
              type: string
              format: date-time
              description: When to poll again for `processing` state.
            completed:
              type: string
              format: date-time
              description: When the task was completed for `done` state.
        publicationId:
          type: string
          description: the identifier of the root publication
        sender:
          $ref: "#/components/schemas/EboxId"
        actor:
          $ref: "#/components/schemas/EboxId"
        self:
          type: string
          description: URL of the current page.
    MulticastTaskState:
      type: string
      enum: [ created, pending, error, done ]
      description: The general status of the task.
    OrderedRoutingRules:
      description: "Partition routing rules on an ebox already ordered from the highest priority to the lowest priority."
      type: "array"
      items:
        $ref: "#/components/schemas/RoutingRule"
    RoutingRule:
      description: Partition rule to ease the receipt of this kind of messages
      type: object
      required:
        - routingRuleId
        - priority
        - conditions
        - targetPartitionId
      properties:
        routingRuleId:
          type: integer
          description: Routing rule technical identifier
        priority:
          type: integer
          minimum: 0
          description: "The position in the list of routing rules if the list is ordered by priority. The higher is this number, the less priority has the routing rule. For example, if the priority number is 5, this rule must be applied to messages matching the condition instead of the rules that have a higher priority number and with matching condition. There should not be routing rules with the same priority number. If a routing rule is created, the routing rule having the same priority number and all other routing rules having a higher priority number should have their priority number incremented by 1."
        conditions:
          type: array
          items:
            type: object
            description: "Criteria to follow to map a message to a partition. If a property is not given or has a null value, it means that the property can have any value like a wildcard. For example, if condition:{senderApplicationId:myApplication, senderOrganizationId:0123456789} then it means that every new messages from the organization 0123456789 and the sender application myApplication should be moved to the target partition."
            properties:
              messageTypeId:
                type: string
                description: identification of the message type
              senderApplicationId:
                type: string
                description: identification of the sender application
              senderOrganizationId:
                $ref: "#/components/schemas/EnterpriseNumber"
        targetPartitionId:
          type: string
          description: the partition where the new messages matching the condition must be moved to.
        creationDate:
          type: string
          description: Date when the user created the routing rule
          format: date-time
    Ssin:
      description: Social Security Identification Number issued by the National Register or CBSS
      type: string
      pattern: '^\d{11}$'
      example: "44022722580"
    # NOTIFICATION SCHEMA
    # The objects below are marked as never used by swagger editor but are used and inherit from DocumentProviderNotificationEvent
    RoutingRuleEvent:
      description: "This object inherit from DocumentProviderNotificationEvent and define the data object with the notification schema for a notification about a newly created routing rule."
      type: object
      allOf:
        - $ref: "#/components/schemas/DocumentProviderNotificationEvent"
      required:
        - data
      properties:
        data:
          $ref: "#/components/schemas/RoutingRuleEventData"

    RoutingRuleEventCreated:
      allOf:
        - $ref: "#/components/schemas/RoutingRuleEvent"
    RoutingRuleEventUpdated:
      allOf:
        - $ref: "#/components/schemas/RoutingRuleEvent"
    RoutingRuleEventDeleted:
      allOf:
        - $ref: "#/components/schemas/RoutingRuleEvent"

    RoutingRuleEventData:
      description: Data specific to the routing rule event
      type: object
      properties:
        enterpriseNumber:
          $ref: "#/components/schemas/EnterpriseNumber"
        routingRuleId:
          type: integer
          description: The technical identifier of the added, modified or deleted routing rule. If this is an added or modified routing rule, it can be found in the list of routing rules in the property orderedRoutingRules.
        orderedRoutingRules:
          $ref: "#/components/schemas/OrderedRoutingRules"
      required: [ routingRuleId, orderedRoutingRules ]

    PartitionEvent:
      description: "This object inherit from DocumentProviderNotificationEvent and define the data object with the notification schema for a notification about a newly created partition."
      type: object
      allOf:
        - $ref: "#/components/schemas/DocumentProviderNotificationEvent"
      required:
        - data
      properties:
        data:
          $ref: "#/components/schemas/PartitionEventData"

    PartitionEventData:
      description: "data specific to the Partition event"
      type: object
      properties:
        enterpriseNumber:
          $ref: "#/components/schemas/EnterpriseNumber"
        partitionId:
          description: "The partition business identifier"
          type: "string"
          example: "HRdepartment"
      required: [ enterpriseNumber, partitionId ]

    PartitionEventCreated:
      allOf:
        - $ref: '#/components/schemas/PartitionEvent'
    PartitionEventDeleted:
      allOf:
        - $ref: '#/components/schemas/PartitionEvent'


    UserPartitionRightsEvent:
      description: "This object inherit from DocumentProviderNotificationEvent and define the data object with the notification schema for a notification about a new access given to a human user to consult a partition"
      type: object
      allOf:
        - $ref: "#/components/schemas/DocumentProviderNotificationEvent"
      required:
        - data
      properties:
        data:
          $ref: "#/components/schemas/UserPartitionRightsEventData"
    UserPartitionRightsEventAdded:
      allOf:
        - $ref: '#/components/schemas/UserPartitionRightsEvent'
    UserPartitionRightsEventRemoved:
      allOf:
        - $ref: '#/components/schemas/UserPartitionRightsEvent'


    UserPartitionRightsEventData:
      description: data specific to the userPartitionRights event
      type: object
      properties:
        enterpriseNumber:
          $ref: "#/components/schemas/EnterpriseNumber"
        partitionId:
          description: "The partition business identifier"
          type: "string"
          example: "HRdepartment"
        userSsin:
          $ref: "#/components/schemas/Ssin"
      required: [ enterpriseNumber, partitionId, userSsin ]

  responses:
    BadRequest:
      description: "The input message is incorrect."
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
          examples:
            badRequest:
              value:
                type: urn:problem-type:belgif:badRequest
                href: https://www.belgif.be/specification/rest/api-guide/problems/badRequest.html
                status: 400
                title: Bad Request
                detail: The input message is incorrect

    Conflict:
      description: "The request has already been served."
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
          examples:
            conflict:
              value:
                type: urn:problem-type:belgif:badRequest
                href: https://www.belgif.be/specification/rest/api-guide/problems/badRequest.html
                status: 409
                title: Conflict
                detail: The resource has already been served
    Unauthorized:
      description: "The consumer must pass a valid access token in the Authorization HTTP header for each request to a secure resource."
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
          examples:
            noAccessToken:
              value:
                type: urn:problem-type:belgif:noAccessToken
                href: https://www.belgif.be/specification/rest/api-guide/problems/noAccessToken.html
                status: 401
                title: No Access Token
                detail: No Bearer access token found in Authorization HTTP header
            invalidAccessToken:
              value:
                type: urn:problem-type:belgif:invalidAccessToken
                href: https://www.belgif.be/specification/rest/api-guide/problems/invalidAccessToken.html
                status: 401
                title: Invalid Access Token
                detail: The Bearer access token found in the Authorization HTTP header is invalid

    Forbidden:
      description: "The consumer access token doesn't have the required scope to invoke the operation."
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
          examples:
            missingScope:
              value:
                type: urn:problem-type:belgif:missingScope
                href: https://www.belgif.be/specification/rest/api-guide/problems/missingScope.html
                status: 403
                title: Missing Scope
                detail: Forbidden to access the resource
            missingPermission:
              value:
                type: urn:problem-type:belgif:missingPermission
                href: https://www.belgif.be/specification/rest/api-guide/problems/missingPermission.html
                status: 403
                title: Missing Permission
                detail: Not permitted to access the ressource

    NotFound:
      description: "The requested resource cannot be found."
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
          examples:
            resourceNotFound:
              value:
                type: urn:problem-type:belgif:resourceNotFound
                href: https://www.belgif.be/specification/rest/api-guide/problems/resourceNotFound.html
                status: 404
                title: Resource Not Found
                detail: No resource /enterprises found

    InternalServerError:
      description: "The server has encountered a situation it doesn't know how to handle."
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
          examples:
            internalServerError:
              value:
                type: urn:problem-type:belgif:internalServerError
                href: https://www.belgif.be/specification/rest/api-guide/problems/internalServerError.html
                status: 500
                title: Internal Server Error

