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
  /818:
    post:
      summary: Définition d'un message 818
      operationId: message818
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BodyType818'
      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:
    BodyType818:
      type: object
      properties:
        AcceptedOrRejectedReportOfReceiptExport:
          $ref: '#/components/schemas/AcceptedOrRejectedReportOfReceiptExportType'
      required:
        - AcceptedOrRejectedReportOfReceiptExport

    AcceptedOrRejectedReportOfReceiptExportType:
      type: object
      properties:
        Attributes:
          $ref: '#/components/schemas/AttributesType818'
        ConsigneeTrader:
          $ref: '#/components/schemas/ConsigneeTraderType818'
        ExciseMovement:
          $ref: '#/components/schemas/ExciseMovementType818'
        DeliveryPlaceTrader:
          $ref: '#/components/schemas/DeliveryPlaceTraderType818'
        ReportOfReceiptExport:
          $ref: '#/components/schemas/ReportOfReceiptExportType'
        BodyReportOfReceiptExport:
          type: array
          maxItems: 999
          items:
            $ref: '#/components/schemas/BodyReportOfReceiptExportType'
      required:
        - Attributes
        - ExciseMovement
        - ReportOfReceiptExport

    AttributesType818:
      type: object
      description: |
        | **Nom de l'élément**                           | **Référentiels** | **Règles** | **Conditions** |
        |------------------------------------------------|------------------|------------|----------------|
        | DateAndTimeOfValidationOfReportOfReceiptExport |                  | IC_RG_C149 |                |
        | Status                                         | Ref_67 (TC50)    | FR_RG_R132 |                |
      properties:
        DateAndTimeOfValidationOfReportOfReceiptExport:
          $ref: '../ie/types.yaml#/components/schemas/DateTimeType'
        Status:
          $ref: '../ie/types.yaml#/components/schemas/ExciseOperateStateTypes'

    ConsigneeTraderType818:
      type: object
      description: |
        | **Nom de l'élément** | **Référentiels**                                      | **Règles** | **Conditions** |
        |----------------------|-------------------------------------------------------|------------|----------------|
        | Traderid             | IC_RG_R045<br>IC_RG_R271<br>IC_RG_R272<br>IC_RG_BR021 | IC_RG_C010 |                |
        | TraderName           |                                                       |            |                |
        | StreetName           |                                                       |            |                |
        | StreetNumber         |                                                       |            |                |
        | PostCode             |                                                       |            |                |
        | City                 |                                                       |            |                |
        | ConsigneeTraderEAs   | FR_RG_R053 / FR_RG_R137                               | FR_RG_R127 | IC_RG_C155     |
        | language             | Ref_28 (BC12)                                         | IC_RG_C002 |                |
      properties:
        Traderid:
          $ref: '../ie/types.yaml#/components/schemas/TraderidType'
        TraderName:
          $ref: '../ie/types.yaml#/components/schemas/TraderNameType'
        StreetName:
          $ref: '../ie/types.yaml#/components/schemas/StreetNameType'
        StreetNumber:
          $ref: '../ie/types.yaml#/components/schemas/StreetNumberType'
        Postcode:
          $ref: '../ie/types.yaml#/components/schemas/PostcodeType'
        City:
          $ref: '../ie/types.yaml#/components/schemas/CityType'
        ConsigneeTraderEAs:
          type: array
          maxItems: 999
          items:
            $ref: '#/components/schemas/ConsigneeTraderEAType818'
        __language:
          $ref: '../ie/types.yaml#/components/schemas/LanguageCodeType'
      required:
        - TraderName
        - StreetName
        - Postcode
        - City

    ConsigneeTraderEAType818:
      type: object
      description: |
        | **Nom de l'élément** | **Référentiels**        | **Règles** | **Conditions** |
        |----------------------|-------------------------|------------|----------------|
        | TraderExciseNumber   | FR_RG_R053 / FR_RG_R137 | FR_RG_R127 |                |
      properties:
        TraderExciseNumber:
          $ref: '../ie/types.yaml#/components/schemas/ExciseNumberType'

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

    DeliveryPlaceTraderType818:
      type: object
      description: |
        | **Nom de l'élément** | **Référentiels**                                    | **Règles** | **Conditions** |
        |----------------------|-----------------------------------------------------|------------|----------------|
        | Traderid             | IC_RG_R045/ IC_RG_BR022<br>IC_RG_R271<br>IC_RG_R272 | IC_RG_C074 |                |
        | TraderName           |                                                     | IC_RG_C079 |                |
        | StreetName           |                                                     | IC_RG_C078 |                |
        | StreetNumber         |                                                     |            |                |
        | PostCode             |                                                     | IC_RG_C078 |                |
        | City                 |                                                     | IC_RG_C078 |                |
        | language             | Ref_28 (BC12)                                       | IC_RG_C002 |                |
      properties:
        Traderid:
          $ref: '../ie/types.yaml#/components/schemas/TraderidType'
        TraderName:
          $ref: '../ie/types.yaml#/components/schemas/TraderNameType'
        StreetName:
          $ref: '../ie/types.yaml#/components/schemas/StreetNameType'
        StreetNumber:
          $ref: '../ie/types.yaml#/components/schemas/StreetNumberType'
        Postcode:
          $ref: '../ie/types.yaml#/components/schemas/PostcodeType'
        City:
          $ref: '../ie/types.yaml#/components/schemas/CityType'
        __language:
          $ref: '../ie/types.yaml#/components/schemas/LanguageCodeType'

    ReportOfReceiptExportType:
      type: object
      description: |
        | **Nom de l'élément**          | **Référentiels**                          | **Règles**               | **Conditions**                            |
        |-------------------------------|-------------------------------------------|--------------------------|-------------------------------------------|
        | DateOfArrivalOfExciseProducts | IC_RG_BR023                               |                          |                                           |
        | GlobalConclusionOfReceipt     | Ref_24 (TC16)<br>FR_RG_R051<br>FR_RG_R146 | IC_RG_C119<br>IC_RG_C140 | IC_RG_C119 (jamais le cas pour un FRA818) |
        | LSDComplementaryInformation   |                                           |                          |                                           |
      properties:
        DateOfArrivalOfExciseProducts:
          $ref: '../ie/types.yaml#/components/schemas/DateType'
        GlobalConclusionOfReceipt:
          $ref: '../ie/tcl.yaml#/components/schemas/GlobalConclusionOfReceipt'
        ComplementaryInformation:
          $ref: '#/components/schemas/LSDComplementaryInformationType818'
      required:
        - DateOfArrivalOfExciseProducts
        - GlobalConclusionOfReceipt

    BodyReportOfReceiptExportType:
      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)                            | FR_RG_R135                             |                |
        | ObservedShortageOrExcess    | IC_RG_R232                               | IC_RG_C067                             |                |
        | ExciseProductCode           | Ref_21 (BC36)<br>IC_RG_R263              |                                        |                |
        | RefusedQuantity             | IC_RG_R232<br>IC_RG_BR025                | IC_RG_C095                             |                |
        | ExemptQuantity              | FR_RG_R047                               | FR_RG_R124<br>FR_RG_R133<br>FR_RG_R147 |                |
        | SuspendedQuantity           | FR_RG_R047                               | FR_RG_R124<br>FR_RG_R133<br>FR_RG_R147 |                |
        | ConsumptionQuantity         | FR_RG_R047                               | FR_RG_R124<br>FR_RG_R133<br>FR_RG_R147 |                |
      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'
        ExemptQuantity:
          $ref: '../fr/fr-v3.yaml#/components/schemas/ExemptQuantityType'
        SuspendedQuantity:
          $ref: '../fr/fr-v3.yaml#/components/schemas/SuspendedQuantityType'
        ConsumptionQuantity:
          $ref: '../fr/fr-v3.yaml#/components/schemas/ConsumptionQuantityType'
        UnsatisfactoryReasonCode:
          type: array
          maxItems: 9
          items:
            $ref: '#/components/schemas/UnsatisfactoryReasonCodeType818'
      required:
        - BodyRecordUniqueReference
        - ExciseProductCode

    UnsatisfactoryReasonCodeType818:
      type: object
      description: |
        | **Nom de l'élément**     | **Référentiels** | **Règles** | **Conditions** |
        |--------------------------|------------------|------------|----------------|
        | UnsatisfactoryReasonCode | Ref_56 (BC46)    |            |                |
        | ComplementaryInformation |                  | IC_RG_C126 |                |
      properties:
        UnsatisfactoryReasonCode:
          $ref: '../ie/types.yaml#/components/schemas/UnsatisfactoryReasonCodeType'
        ComplementaryInformation:
          $ref: '#/components/schemas/LSDComplementaryInformationType818'
      required:
        - UnsatisfactoryReasonCode

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