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
  /837:
    post:
      summary: Définition d'un message 837
      operationId: message837
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BodyType837'
      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:
    BodyType837:
      type: object
      properties:
        ExplanationOnDelayForDelivery:
          $ref: '#/components/schemas/ExplanationOnDelayForDeliveryType'
      required:
        - ExplanationOnDelayForDelivery

    ExplanationOnDelayForDeliveryType:
      type: object
      properties:
        Attributes:
          $ref: '#/components/schemas/AttributesType837'
        ExciseMovement:
          $ref: '#/components/schemas/ExciseMovementType837'
      required:
        - Attributes
        - ExciseMovement

    AttributesType837:
      type: object
      description: |
        | **Nom de l'élément**     | **Référentiels** | **Règles**               | **Conditions** |
        |--------------------------|------------------|--------------------------|----------------|
        | MessageRole              |                  | FR_RG_R138<br>FR_RG_R150 |                |
        | ExplanationCode          | Ref_12 (BC51)    |                          |                |
        | ComplementaryInformation |                  |                          | IC_RG_C128     |
        | TypeDeclarant            |                  | IC_RG_R072               |                |
      properties:
        MessageRole:
          $ref: '../ie/tcl.yaml#/components/schemas/MessageRoleCode'
        ExplanationCode:
          $ref: '../ie/types.yaml#/components/schemas/ExplanationCodeType'
        ComplementaryInformation:
          $ref: '#/components/schemas/LSDComplementaryInformationType837'
        TypeDeclarant:
          $ref: '../ie/tcl.yaml#/components/schemas/SubmitterType'
      required:
        - MessageRole
        - ExplanationCode
        - TypeDeclarant

    ExciseMovementType837:
      type: object
      description: |
        | **Nom de l'élément**        | **Référentiels** | **Règles**               | **Conditions** |
        |-----------------------------|------------------|--------------------------|----------------|
        | AdministrativeReferenceCode |                  | IC_RG_R030               |                |
        | SequenceNumber              |                  | FR_RG_R148<br>IC_RG_R232 |                |
      properties:
        AdministrativeReferenceCode:
          $ref: '../ie/types.yaml#/components/schemas/AdministrativeReferenceCodeType'
        SequenceNumber:
          $ref: '../ie/types.yaml#/components/schemas/SequenceNumberType'
      required:
        - AdministrativeReferenceCode
        - SequenceNumber

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