openapi: 3.1.0
info:
  title: Tango Currency Conversion — File
  version: "0.5"
  description: |
    SFTP file-based inbound. Client drops a pipe-delimited file of forex rates;
    Tango picks the file up, inserts new rate entries into its forex table,
    and moves the file to `Processed/`. This integration ONLY creates new
    entries — it does not update existing ones.

    Field names in this file version differ from the API version's:
      source_currency_code (file) vs source_currency (API)
      to_currency_code     (file) vs converted_currency (API)
      exchange_rate        (file) vs spot_exchange_rate (API)
      Avg_rate             (file) vs avg_exchange_rate (API)
      exchg_rate_date      (file) vs exchange_rate_date (API)
    The file version also requires `client_id` (not present in the API). All
    file-side names preserved verbatim from the source data-mapping table.
  x-direction: inbound
  x-source: Client System
  x-destination: Tango
  x-transport: sftp
  x-file-format: pipe-delimited text (.txt)
  x-file-naming-convention: "{ClientName}_currency_conversion_MMDDYYYYHHMM.txt"
servers:
  - url: sftp://sftp.tangoanalytics.com
    description: Production SFTP
    x-environment: production
    x-path: <TBD>
  - url: sftp://sftpdev.tangoanalytics.com
    description: Test SFTP (SIT/UAT)
    x-environment: test
    x-path: <TBD>
tags:
  - name: Currency Conversion File
paths:
  /inbound/currency-conversion:
    post:
      summary: Drop currency conversion file at SFTP path
      description: |
        Virtual operation. SFTP path is `<TBD>` per the source doc; placeholder
        used here. Confirm with Tango operations.
      operationId: deliverCurrencyConversionFile
      tags: [Currency Conversion File]
      requestBody:
        required: true
        content:
          text/plain:
            schema:
              type: string
              format: binary
              x-record-schema:
                $ref: "#/components/schemas/CurrencyRow"
      responses:
        "200":
          description: File received and queued for processing.
components:
  securitySchemes:
    sftpUserPassword:
      type: http
      scheme: basic
  schemas:
    CurrencyRow:
      type: object
      required:
        - client_id
        - source_currency_code
        - to_currency_code
        - exchange_rate
        - exchg_rate_date
        - Effective_From
        - Effective_To
      properties:
        client_id:
          type: number
          description: Tango-specific client identifier.
          example: 217
        source_currency_code:
          type: string
          description: ISO 4217 3-letter code (source).
          example: "USD"
        to_currency_code:
          type: string
          description: ISO 4217 3-letter code (destination).
          example: "INR"
        exchange_rate:
          type: number
          description: Spot exchange rate.
          example: 72.71000
        Avg_rate:
          type: number
          description: |
            Average rate. Note inconsistent case in source mapping
            (`Avg_rate` vs other lowercase field names). Preserved verbatim.
        exchg_rate_date:
          type: string
          description: "MM/DD/YYYY."
        Effective_From:
          type: string
          description: |
            "MM/DD/YYYY." NOTE: source uses PascalCase here while other
            fields are lowercase. Preserved verbatim.
        Effective_To:
          type: string
          description: "MM/DD/YYYY. PascalCase in source — preserved."
security:
  - sftpUserPassword: []
