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
  /3000:
    post:
      summary: Définition d'un message 3000
      operationId: message3000
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BodyType3000'
      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:
    BodyType3000:
      type: object
      properties:
        AcceptedOrRejectedReportOfReceiptExportConsignor:
          $ref: '#/components/schemas/AcceptedOrRejectedReportOfReceiptExportConsignorType'
      required:
        - AcceptedOrRejectedReportOfReceiptExportConsignor

    AcceptedOrRejectedReportOfReceiptExportConsignorType:
      type: object
      properties:
        Attributes:
          $ref: '#/components/schemas/AttributesType3000'
        ConsigneeTrader:
          $ref: '#/components/schemas/ConsigneeTraderType3000'
        ExciseMovementEad:
          $ref: '#/components/schemas/ExciseMovementEadType3000'
        DeliveryPlaceTrader:
          $ref: '#/components/schemas/DeliveryPlaceTraderType3000'
        DestinationCustomsOffice:
          $ref: '#/components/schemas/DestinationCustomsOfficeType3000'
        ReportOfReceiptExport:
          $ref: '#/components/schemas/ReportOfReceiptExportType3000'
        BodyReportOfReceiptExport:
          type: array
          maxItems: 999
          items:
            $ref: '#/components/schemas/BodyReportOfReceiptExportType'
        ConsignorTrader:
          $ref: '#/components/schemas/ConsignorTraderType3000'
      required:
        - Attributes
        - ExciseMovementEad
        - ReportOfReceiptExport

    AttributesType3000:
      type: object
      description: |
        | Nom de l'élément                               | Référentiels | Règles     | Conditions |
        |------------------------------------------------|--------------|------------|------------|
        | DateAndTimeOfValidationOfReportOfReceiptExport | NA           | IC_RG_C149 |            |
      properties:
        DateAndTimeOfValidationOfReportOfReceiptExport:
          $ref: '../ie/types.yaml#/components/schemas/DateTimeType'

    ConsigneeTraderType3000:
      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             |                                                       |            |            |
        | 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'
      required:
        - TraderName
        - StreetName
        - Postcode
        - City
        - __language

    ExciseMovementEadType3000:
      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

    DeliveryPlaceTraderType3000:
      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)<br>IC_RG_R031                         | 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'

    DestinationCustomsOfficeType3000:
      type: object
      description: |
        | Nom de l'élément | Référentiels | Règles | Conditions |
        |------------------|--------------|--------|------------|
        | ReferenceNumber  | R032         | NA     |            |
      properties:
        ReferenceNumber:
          $ref: '../ie/types.yaml#/components/schemas/ExciseOfficeCodeType'
      required:
        - ReferenceNumber

    ReportOfReceiptExportType3000:
      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<br>IC_RG_C119 (jamais le cas pour un FRA818) |
        | ComplementaryInformation      |                                           |        |                                                                       |
      properties:
        DateOfArrivalOfExciseProducts:
          $ref: '../ie/types.yaml#/components/schemas/DateType'
        GlobalConclusionOfReceipt:
          $ref: '../ie/tcl.yaml#/components/schemas/GlobalConclusionOfReceipt'
        ComplementaryInformation:
          $ref: '#/components/schemas/LSDComplementaryInformationType3000'
      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 |            |
      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'
        UnsatisfactoryReason:
          type: array
          maxItems: 9
          items:
            $ref: '#/components/schemas/UnsatisfactoryReasonType3000'
      required:
        - BodyRecordUniqueReference
        - ExciseProductCode

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

    LSDComplementaryInformationType3000:
      type: object
      properties:
        _content_:
          $ref: '../ie/types.yaml#/components/schemas/ComplementaryInformationType'
        __language:
          $ref: '../ie/types.yaml#/components/schemas/LanguageCodeType'
      required:
        - __language
        - _content_
    
    ConsignorTraderType3000:
      type: object
      description: |
        | Nom de l'élément   | Référentiels | Règles | Conditions |
        |--------------------|--------------|--------|------------|
        | TraderExciseNumber | NA           | NA     |            |
      properties:
        TraderExciseNumber:
          $ref: '../fr/fr-v3.yaml#/components/schemas/NumAccExpType'
