parameters:
  - $ref: '../../parameters/applicationId.yml'
  - $ref: '../../parameters/attachmentId.yml'

get:
  operationId: get-application-attachment
  summary: Anhang abrufen
  description: Ruft einen Anhang des Antrags ab.
  tags:
    - Application Retrieval
  security:
    - OAuth20:
        - 'destination:manage'
        - 'destination:subscribe'
  responses:
    '200':
      description: OK
      content:
        application/jose:
          schema:
            $ref: '../../schemas/attachment.yml'
          examples:
            example-1:
              $ref: '../../examples/encrypted-message.yml'
    '400':
      description: Bad Request
      content:
        application/problem+json:
          schema:
            $ref: ../../schemas/error.yml
    '401':
      description: Unauthorized
      content:
        application/problem+json:
          schema:
            $ref: ../../schemas/error.yml
    '403':
      description: Forbidden
      content:
        application/problem+json:
          schema:
            $ref: ../../schemas/error.yml
    '404':
      description: Not Found
      content:
        application/problem+json:
          schema:
            $ref: ../../schemas/error.yml

put:
  operationId: add-application-attachment
  summary: Anhang hinzufügen
  description: Upload des in announcedContentStructure angekündigten Anhangs als JSON Web Encryption unter der mitgeteilten UUID.
  tags:
    - Application Transfer
  security:
    - OAuth20:
        - 'destination:send'
  requestBody:
    required: true
    content:
      application/jose:
        schema:
          $ref: '../../schemas/create-attachment.yml'
        examples:
          example-1:
            $ref: '../../examples/encrypted-message.yml'
  responses:
    '201':
      description: Anhang erfolgreich hinzugefügt
      content:
        application/json:
          schema:
            $ref: '../../schemas/empty-body.yml'
    '400':
      description: Bad Request
      content:
        application/problem+json:
          schema:
            $ref: ../../schemas/error.yml
    '401':
      description: Unauthorized
      content:
        application/problem+json:
          schema:
            $ref: ../../schemas/error.yml
    '403':
      description: Forbidden
      content:
        application/problem+json:
          schema:
            $ref: ../../schemas/error.yml
    '413':
      description: Request Entity Too Large
      content:
        application/problem+json:
          schema:
            $ref: ../../schemas/error.yml
    '415':
      description: Unsupported Media Type (wrong content type sent)
      content:
        application/problem+json:
          schema:
            $ref: ../../schemas/error.yml
