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
  /881:
    post:
      summary: Définition d'un message 881
      operationId: message881
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BodyType881'
      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:
    BodyType881:
      type: object
      properties:
        ManualClosureResponse:
          $ref: '#/components/schemas/ManualClosureResponseType'
      required:
        - ManualClosureResponse

    ManualClosureResponseType:
      type: object
      properties:
        Attributes:
          $ref: '#/components/schemas/AttributesType881'
        SupportingDocuments:
          type: array
          maxItems: 9
          items:
            $ref: '../ie/types.yaml#/components/schemas/SupportingDocumentsType'
        BodyManualClosure:
          type: array
          maxItems: 999
          items:
            $ref: '#/components/schemas/BodyManualClosureType'
      required:
        - Attributes

    AttributesType881:
      type: object
      description: |
        | Nom de l'élément                         | Référentiels   | Règles                   | Conditions |
        |------------------------------------------|----------------|--------------------------|------------|
        | AdministrativeReferenceCode              |                | IC_RG_R030<br>IC_RG_R273 |            |
        | SequenceNumber                           |                | IC_RG_R232               |            |
        | DateOfArrivalOfExciseProducts            |                | IC_RG_BR023              |            |
        | GlobalConclusionOfReceipt                | Ref_24 (TC16)  |                          |            |
        | ComplementaryInformation                 |                |                          |            |
        | ManualClosureRequestReasonCode           | Ref_30 (BC107) |                          |            |
        | ManualClosureRequestReasonCodeComplement |                |                          | IC_RG_C204 |
        | ManualClosureRequestAccepted             | Ref_99 (TC27)  |                          |            |
        | ManualClosureRejectionReasonCode         | Ref_29 (BC108) |                          | IC_RG_C205 |
        | ManualClosureRejectionComplement         |                |                          | IC_RG_C206 |
      properties:
        AdministrativeReferenceCode:
          $ref: '../ie/types.yaml#/components/schemas/AdministrativeReferenceCodeType'
        SequenceNumber:
          $ref: '../ie/types.yaml#/components/schemas/SequenceNumberType'
        DateOfArrivalOfExciseProducts:
          $ref: '../ie/types.yaml#/components/schemas/DateType'
        GlobalConclusionOfReceipt:
          $ref: '../ie/tcl.yaml#/components/schemas/GlobalConclusionOfReceipt'
        ComplementaryInformation:
          $ref: '#/components/schemas/LSDComplementaryInformationType881'
        ManualClosureRequestReasonCode:
          $ref: '../ie/types.yaml#/components/schemas/ManualClosureRequestReasonCodeType'
        ManualClosureRequestReasonCodeComplement:
          $ref: '../ie/types.yaml#/components/schemas/LSDManualClosureRequestReasonCodeComplementType'
        ManualClosureRequestAccepted:
          $ref: '../ie/tcl.yaml#/components/schemas/Flag'
        ManualClosureRejectionReasonCode:
          $ref: '../ie/types.yaml#/components/schemas/ManualClosureRejectionReasonCodeType'
        ManualClosureRejectionComplement:
          $ref: '#/components/schemas/LSDManualClosureRejectionComplementType'
      required:
        - AdministrativeReferenceCode
        - SequenceNumber
        - ManualClosureRequestReasonCode
        - ManualClosureRequestAccepted

    BodyManualClosureType:
      type: object
      description: |
        | Nom de l'élément            | Référentiels  | Règles                                  | Conditions |
        |-----------------------------|---------------|-----------------------------------------|------------|
        | BodyRecordUniqueReference   |               | IC_RG_R058<br>IC_RG_R232<br>IC_RG_BR024 |            |
        | IndicatorOfShortageOrExcess | Ref_62 (TC47) |                                         |            |
        | ObservedShortageOrExcess    |               |  IC_RG_R232                             | IC_RG_C067 |
        | ExciseProductCode           | Ref_21 (BC36) |                                         |            |
        | RefusedQuantity             |               | IC_RG_ R232<br>IC_RG_BR025              | IC_RG_C095 |
        | ComplementaryInformation    |               |                                         |            |
      properties:
        BodyRecordUniqueReference:
          $ref: '../ie/types.yaml#/components/schemas/BodyRecordUniqueReferenceType'
        IndicatorOfShortageOrExcess:
          $ref: '../ie/tcl.yaml#/components/schemas/IndicatorOfShortageOrExcess'
        ObservedShortageOrExcess:
          $ref: '../ie/types.yaml#/components/schemas/ObservedShortageOrExcessType'
        ExciseProductCode:
          $ref: '../ie/types.yaml#/components/schemas/ExciseProductCodeType'
        RefusedQuantity:
          $ref: '../ie/types.yaml#/components/schemas/RefusedQuantityType'
        ComplementaryInformation:
          $ref: '#/components/schemas/LSDComplementaryInformationType881'
      required:
        - BodyRecordUniqueReference

    LSDComplementaryInformationType881:
      type: object
      properties:
        _content_:
          $ref: '../ie/types.yaml#/components/schemas/ComplementaryInformationType'
        __language:
          $ref: '../ie/types.yaml#/components/schemas/LanguageCodeType'
      required:
        - __language
        - _content_

    LSDManualClosureRejectionComplementType:
      type: object
      properties:
        _content_:
          $ref: '../ie/types.yaml#/components/schemas/ManualClosureRejectionComplementType'
        __language:
          $ref: '../ie/types.yaml#/components/schemas/LanguageCodeType'
      required:
        - __language
        - _content_


