openapi: 3.0.3
info:
  title: Interface API Gamma Refonte
  description: Interface API Gamma Refonte
  version: 1.0.0
  contact:
    name: DGDDI - Douane Française
    url: https://www.douane.gouv.fr/

paths:
  # Chemin facultatif
  /836:
    post:
      summary: Définition d'un message 836
      operationId: message836
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BodyType836'
      parameters:
        - $ref: '../api/headerHttp.yaml#/components/parameters/messageId'
      responses:
        '200':
          description: OK
          content:
            text/plain:
              schema:
                $ref: '../api/retourHttp.yaml#/components/schemas/retour200'

components:
  schemas:
    BodyType836:
      type: object
      properties:
        ExportDeclarationInvalidationNotificationToMSAOfDispatchConsignor:
          $ref: '#/components/schemas/ExportDeclarationInvalidationNotificationToMSAOfDispatchConsignorType'
      required:
        - ExportDeclarationInvalidationNotificationToMSAOfDispatchConsignor

    ExportDeclarationInvalidationNotificationToMSAOfDispatchConsignorType:
      type: object
      properties:
        ExciseMovement:
          type: array
          minItems: 1
          maxItems: 999
          items:
            $ref: '#/components/schemas/ExciseMovementType836'
      required:
        - ExciseMovement

    ExciseMovementType836:
      type: object
      description: |
        | Nom de l'élément            | Référentiels | Règles     | Conditions |
        |-----------------------------|--------------|------------|------------|
        | AdministrativeReferenceCode |              | IC_RG_R030 |            |
        | SequenceNumber              |              | IC_RG_R232 |            |
        | ExportOperation             |              |            |            |
        | CustomsOfficeOfExport       |              |            |            |
        | MsaOfExport                 |              |            |            |
        | GoodsShipment               |              |            |            |
      properties:
        AdministrativeReferenceCode:
          $ref: '../ie/types.yaml#/components/schemas/AdministrativeReferenceCodeType'
        SequenceNumber:
          $ref: '../ie/types.yaml#/components/schemas/SequenceNumberType'
        ExportOperation:
          $ref: '#/components/schemas/ExportOperationType836'
        CustomsOfficeOfExport:
          $ref: '#/components/schemas/CustomsOfficeOfExportType836'
        MsaOfExport:
          $ref: '#/components/schemas/MsaOfExportType836'
        GoodsShipment:
          $ref: '#/components/schemas/GoodsShipmentType836'
      required:
        - AdministrativeReferenceCode
        - SequenceNumber
        - ExportOperation
        - MsaOfExport
        - GoodsShipment

    ExportOperationType836:
      type: object
      description: |
        | Nom de l'élément | Référentiels | Règles | Conditions |
        |------------------|--------------|--------|------------|
        | Mrn              |              |        |            |
        | InvalidationDate |              |        |            |
      properties:
        Mrn:
          $ref: '../ie/types.yaml#/components/schemas/MrnType'
        InvalidationDate:
          $ref: '../ie/types.yaml#/components/schemas/DateType'
      required:
        - Mrn
        - InvalidationDate

    CustomsOfficeOfExportType836:
      type: object
      description: |
        | Nom de l'élément | Référentiels | Règles                   | Conditions |
        |------------------|--------------|--------------------------|------------|
        | ReferenceNumber  |              | IC_RG_R032<br>IC_RG_R236 |            |
      properties:
        ReferenceNumber:
          $ref: '../ie/types.yaml#/components/schemas/ExciseOfficeCodeType'
      required:
        - ReferenceNumber

    MsaOfExportType836:
      type: object
      description: |
        | Nom de l'élément | Référentiels  | Règles | Conditions |
        |------------------|---------------|--------|------------|
        | CountryCode      | BC11 (Ref_31) |        |            |
      properties:
        CountryCode:
          $ref: '../ie/types.yaml#/components/schemas/CountryCodeType'
      required:
        - CountryCode

    GoodsShipmentType836:
      type: object
      description: |
        | Nom de l'élément | Référentiels | Règles | Conditions |
        |------------------|--------------|--------|------------|
        | PreviousDocument |              |        |            |
      properties:
        PreviousDocument:
          type: array
          minItems: 0
          maxItems: 999
          items:
            $ref: '#/components/schemas/PreviousDocumentType836'

    PreviousDocumentType836:
      type: object
      description: |
        | Nom de l'élément | Référentiels | Règles | Conditions |
        |------------------|--------------|--------|------------|
        | SequenceNumber   |              |        |            |
        | Type             |              |        |            |
        | ReferenceNumber  |              |        |            |
      properties:
        SequenceNumber:
          $ref: '../ie/types.yaml#/components/schemas/SequenceNumberType'
        Type:
          $ref: '../ie/types.yaml#/components/schemas/TypeType'
        ReferenceNumber:
          $ref: '../ie/types.yaml#/components/schemas/ReferenceNumberType'
      required:
        - SequenceNumber
        - Type
        - ReferenceNumber
