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
  /819:
    post:
      summary: Définition d'un message 819
      operationId: message819
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BodyType819'
      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:
    BodyType819:
      type: object
      properties:
        AlertOrRejectionOfEADESAD:
          $ref: '#/components/schemas/AlertOrRejectionOfEADESADType'
      required:
        - AlertOrRejectionOfEADESAD

    AlertOrRejectionOfEADESADType:
      type: object
      properties:
        Attributes:
          $ref: '#/components/schemas/AttributesType819'
        ConsigneeTrader:
          $ref: '#/components/schemas/ConsigneeTraderType819'
        ExciseMovement:
          $ref: '#/components/schemas/ExciseMovementType819'
        AlertOrRejection:
          $ref: '#/components/schemas/AlertOrRejectionType'
        AlertOrRejectionOfEadEsadReason:
          type: array
          maxItems: 9
          items:
            $ref: '#/components/schemas/AlertOrRejectionOfEadEsadReasonType'
      required:
        - Attributes
        - ExciseMovement
        - AlertOrRejection
        - DestinationOffice

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

    ConsigneeTraderType819:
      type: object
      description: |
        | **Nom de l'élément** | **Référentiels** | **Règles**                | **Conditions** |
        |----------------------|------------------|---------------------------|----------------|
        | Traderid             |                  | IC_RG_R045<br>IC_RG_BR021 |                |
        | TraderName           |                  | FR_RG_R044                |                |
        | StreetName           |                  | FR_RG_R044                |                |
        | StreetNumber         |                  | FR_RG_R044                |                |
        | PostCode             |                  | FR_RG_R044                |                |
        | City                 |                  | FR_RG_R044                |                |
        | 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:
        - Traderid
        - TraderName
        - StreetName
        - Postcode
        - City

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

    AlertOrRejectionType:
      type: object
      description: |
        | **Nom de l'élément**   | **Référentiels** | **Règles** | **Conditions** |
        |------------------------|------------------|------------|----------------|
        | DateOfAlertOrRejection |                  |            |                |
        | EadRejectedFlag        | Ref_99 (TC27)    |            |                |
      properties:
        DateOfAlertOrRejection:
          $ref: '../ie/types.yaml#/components/schemas/DateType'
        EadEsadRejectedFlag:
          $ref: '../ie/tcl.yaml#/components/schemas/Flag'
      required:
        - EadEsadRejectedFlag
        - DateOfAlertOrRejection

    AlertOrRejectionOfEadEsadReasonType:
      type: object
      description: |
        | **Nom de l'élément**            | **Référentiels** | **Règles** | **Conditions** |
        |---------------------------------|------------------|------------|----------------|
        | AlertOrRejectionOfEadReasonCode | Ref_02 (BC22)    |            |                |
        | ComplementaryInformation        |                  |            | IC_RG_C161     |
      properties:
        AlertOrRejectionOfEadEsadReasonCode:
          $ref: '../ie/types.yaml#/components/schemas/AlertOrRejectionOfMovementReasonCodeType'
        ComplementaryInformation:
          $ref: '#/components/schemas/LSDComplementaryInformationType819'
      required:
        - AlertOrRejectionOfEadEsadReasonCode*

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