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
  /813:
    post:
      summary: Définition d'un message 813
      operationId: message813
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BodyType813'
      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:
    BodyType813:
      type: object
      properties:
        ChangeOfDestination:
          $ref: '#/components/schemas/ChangeOfDestinationType'
      required:
        - ChangeOfDestination

    ChangeOfDestinationType:
      type: object
      properties:
        Attributes:
          $ref: '#/components/schemas/AttributesType813'
        NewTransportArrangerTrader:
          $ref: '#/components/schemas/NewTransportArrangerTraderType813'
        NewTransporterTrader:
          $ref: '#/components/schemas/NewTransporterTraderType813'
        UpdateEadEsad:
          $ref: '#/components/schemas/UpdateEadEsadType'
        ChangedDestination:
          $ref: '#/components/schemas/DestinationChangedType813'
        MovementGuarantee:
          $ref: '#/components/schemas/MovementGuaranteeType813'
        TransportDetails:
          type: array
          maxItems: 99
          items:
            $ref: '#/components/schemas/TransportDetailsType813'
      required:
        - Attributes
        - UpdateEadEsad
        - ChangedDestination

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

    NewTransportArrangerTraderType813:
      type: object
      description: |
        | **Nom de l'élément** | **Référentiels** | **Règles** | **Conditions** |
        |----------------------|------------------|------------|----------------|
        | VatNumber            |                  |            |                |
        | TraderName           |                  |            |                |
        | StreetName           |                  |            |                |
        | StreetNumber         |                  |            |                |
        | PostCode             |                  |            |                |
        | City                 |                  |            |                |
        | language             | R
        ef_28 (BC12)    |            | IC_RG_C002     |
      properties:
        VatNumber:
          $ref: '../ie/types.yaml#/components/schemas/VatNumberType'
        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

    NewTransporterTraderType813:
      type: object
      description: |
        | **Nom de l'élément** | **Référentiels** | **Règles** | **Conditions** |
        |----------------------|------------------|------------|----------------|
        | VatNumber            |                  |            |                |
        | TraderName           |                  |            |                |
        | StreetAndNumber      |                  |            |                |
        | StreetNumber         |                  |            |                |
        | PostCode             |                  |            |                |
        | City                 |                  |            |                |
        | language             | Ref_28 (BC12)    |            | IC_RG_C002     |
      properties:
        VatNumber:
          $ref: '../ie/types.yaml#/components/schemas/VatNumberType'
        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

    TransportDetailsType813:
      type: object
      description: |
        | **Nom de l'élément**         | **Référentiels** | **Règles** | **Conditions** |
        |------------------------------|------------------|------------|----------------|
        | TransportUnitCode            | Ref_53  (BC35)   |            |                |
        | IdentityOfTransportUnits     |                  |            | IC_RG_C156     |
        | CommercialSealIdentification |                  |            |                |
        | ComplementaryInformation     |                  |            |                |
        | language                     | Ref_28 (BC12)    |            | IC_RG_C002     |
        | SealInformation              |                  |            |                |
        | language                     | Ref_28 (BC12)    |            | IC_RG_C002     |
      properties:
        TransportUnitCode:
          $ref: '../ie/types.yaml#/components/schemas/TransportUnitCodeType'
        IdentityOfTransportUnits:
          $ref: '../ie/types.yaml#/components/schemas/IdentityOfTransportUnitsType'
        CommercialSealIdentification:
          $ref: '../ie/types.yaml#/components/schemas/CommercialSealIdentificationType'
        ComplementaryInformation:
          $ref: '#/components/schemas/LSDComplementaryInformationType813'
        SealInformation:
          $ref: '#/components/schemas/LSDSealInformationType813'
        __language:
          $ref: '../ie/types.yaml#/components/schemas/LanguageCodeType'
      required:
        - TransportUnitCode

    UpdateEadEsadType:
      type: object
      description: |
        | **Nom de l'élément**        | **Référentiels** | **Règles**                              | **Conditions**           |
        |-----------------------------|------------------|-----------------------------------------|--------------------------|
        | AdministrativeReferenceCode |                  | IC_RG_BR020<br>IC_RG_R030<br>IC_RG_R273 |                          |
        | JourneyTime                 |                  | IC_RG_R054<br>IC_RG_BR007               |                          |
        | ChangedTransportArrangement | Ref_51 (TC70)    |                                         |                          |
        | SequenceNumber              |                  | IC_RG_R059<br>IC_RG_R232                | FR_RG_R148<br>IC_RG_C149 |
        | InvoiceDate                 |                  |                                         |                          |
        | InvoiceNumber               |                  |                                         |                          |
        | TransportModeCode           | Ref_52 (BC67)    | IC_RG_R056<br>IC_RG_R216                | IC_RG_C182               |
        | ComplementaryInformation    |                  |                                         | IC_RG_C162               |
        | language                    | Ref_28 (BC12)    |                                         | IC_RG_C002               |
      properties:
        AdministrativeReferenceCode:
          $ref: '../ie/types.yaml#/components/schemas/AdministrativeReferenceCodeType'
        JourneyTime:
          $ref: '../ie/types.yaml#/components/schemas/JourneyTimeType'
        ChangedTransportArrangement:
          $ref: '../ie/tcl.yaml#/components/schemas/TransportArrangement'
        SequenceNumber:
          $ref: '../ie/types.yaml#/components/schemas/SequenceNumberType'
        InvoiceDate:
          $ref: '../ie/types.yaml#/components/schemas/DateType'
        InvoiceNumber:
          $ref: '../ie/types.yaml#/components/schemas/InvoiceNumberType'
        TransportModeCode:
          $ref: '../ie/types.yaml#/components/schemas/TransportModeCodeType'
        ComplementaryInformation:
          $ref: '#/components/schemas/LSDComplementaryInformationType813'
        __language:
          $ref: '../ie/types.yaml#/components/schemas/LanguageCodeType'
      required:
        - AdministrativeReferenceCode

    DestinationChangedType813:
      type: object
      description: |
        | **Nom de l'élément**        | **Référentiels** | **Règles**               | **Conditions** |
        |-----------------------------|------------------|--------------------------|----------------|
        | DestinationTypeCode         | Ref_65 (TC77)    | IC_RG_R259<br>FR_RG_R126 |                |
        | NewConsigneeTrader          |                  |                          | FR_RG_C011     |
        | DeliveryPlaceTrader         |                  |                          | IC_RG_C165     |
        | DeliveryPlaceCustomsOffice  |                  |                          | IC_RG_C165     |
      properties:
        DestinationTypeCode:
          $ref: '../ie/tcl.yaml#/components/schemas/ChangedDestinationTypeCode'
        NewConsigneeTrader:
          $ref: '#/components/schemas/NewConsigneeTraderType'
        DeliveryPlaceTrader:
          $ref: '#/components/schemas/DeliveryPlaceTraderType813'
        DeliveryPlaceCustomsOffice:
          $ref: '#/components/schemas/DeliveryPlaceCustomsOfficeType813'
      required:
        - DestinationTypeCode

    NewConsigneeTraderType:
      type: object
      description: |
        | **Nom de l'élément** | **Référentiels** | **Règles**                                                                                                                                                                                                                 | **Conditions** |
        |----------------------|------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------|
        | Traderid             |                  | IC_RG_BR011<br>IC_RG_BR014<br>IC_RG_BR015<br>IC_RG_BR016<br>IC_RG_BR028<br>IC_RG_BR029<br>IC_RG_BR045<br>IC_RG_BR046<br>IC_RG_BR047<br>IC_RG_BR048<br>IC_RG_BR049<br>IC_RG_BR050<br>IC_RG_R045<br>IC_RG_R271<br>IC_RG_R272 | IC_RG_C010     |
        | TraderName           |                  |                                                                                                                                                                                                                            |                |
        | StreetName           |                  |                                                                                                                                                                                                                            |                |
        | StreetNumber         |                  |                                                                                                                                                                                                                            |                |
        | PostCode             |                  |                                                                                                                                                                                                                            |                |
        | City                 |                  |                                                                                                                                                                                                                            |                |
        | language             | Ref_28 (BC12)    |                                                                                                                                                                                                                            | IC_RG_C002     |
        | EoriNumber           |                  |                                                                                                                                                                                                                            | IC_RG_C180     |
      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

    DeliveryPlaceTraderType813:
      type: object
      description: |
        | **Nom de l'élément** | **Référentiels** | **Règles**                                                                        | **Conditions** |
        |----------------------|------------------|-----------------------------------------------------------------------------------|----------------|
        | TraderId             |                  | IC_RG_BR012<br>IC_RG_BR013<br>IC_RG_BR028<br>IC_RG_R045<br>IC_RG_271<br>IC_RG_272 | 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'

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

    MovementGuaranteeType813:
      type: object
      description: |
        | **Nom de l'élément** | **Référentiels** | **Règles** | **Conditions** |
        |----------------------|------------------|------------|----------------|
        | GuarantorTypeCode    | Ref_26 (TC29)    | IC_RG_R215 |                |
        | GuarantorTrader      |                  |            | IC_RG_C017     |
      properties:
        GuarantorTypeCode:
          $ref: '../ie/tcl.yaml#/components/schemas/GuarantorTypeCode'
        GuarantorTrader:
          type: array
          maxItems: 2
          items:
            $ref: '#/components/schemas/GuarantorTraderType813'
      required:
        - GuarantorTypeCode

    GuarantorTraderType813:
      type: object
      description: |
        | **Nom de l'élément** | **Référentiels** | **Règles**               | **Conditions** |
        |----------------------|------------------|--------------------------|----------------|
        | TraderExciseNumber   |                  | IC_RG_R027<br>IC_RG_R271 |                |
        | TraderName           |                  |                          | IC_RG_C101     |
        | StreetName           |                  |                          | IC_RG_C101     |
        | StreetNumber         |                  |                          |                |
        | City                 |                  |                          | IC_RG_C101     |
        | Postcode             |                  |                          | IC_RG_C101     |
        | VatNumber            |                  |                          |                |
        | language             | Ref_28 (BC12)    |                          | IC_RG_C002     |
      properties:
        TraderExciseNumber:
          $ref: '../ie/types.yaml#/components/schemas/ExciseNumberType'
        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'
        VatNumber:
          $ref: '../ie/types.yaml#/components/schemas/VatNumberType'
        __language:
          $ref: '../ie/types.yaml#/components/schemas/LanguageCodeType'

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

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