openapi: 3.1.0
info:
  title: Tango CPI Inbound
  version: "0.3"
  description: |
    Automated inbound integration that pulls CPI (Consumer Price Index) data
    from external public data sources — BLS (US Bureau of Labor Statistics),
    IMF, or World Bank — into Tango's internal index tables. Triggered on a
    monthly schedule by Tango's own job; the API surface modeled here represents
    Tango's internal job, not a client-callable endpoint. The schema captures
    the per-index row that lands in Tango's database after each fetch.

    This is NOT a client-issued integration — clients see CPI/Indexed Rent
    in the Tango UI after the data has been loaded.
  x-direction: inbound
  x-source: BLS / IMF / World Bank (external public data sources)
  x-destination: Tango
  x-transport: automated job (Tango-internal)
  x-frequency: monthly
servers:
  - url: https://www.bls.gov
    description: US Bureau of Labor Statistics (one possible source).
  - url: https://www.imf.org
    description: International Monetary Fund.
  - url: https://api.worldbank.org
    description: World Bank.
tags:
  - name: CPI Indices
paths:
  /cpi/fetch:
    post:
      summary: Internal — apply a CPI index row to Tango
      description: |
        Virtual operation representing one row of CPI index data being inserted
        or updated into Tango's index tables. Source-side endpoints differ
        per provider; this models the post-fetch row shape.
      operationId: applyCPIIndexRow
      tags: [CPI Indices]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CPIIndexRow"
      responses:
        "200":
          description: Index row applied to Tango.
components:
  schemas:
    CPIIndexRow:
      type: object
      required:
        - INDEX_NAME
        - INDEX_CODE
        - INDEX_AS_OF
        - INDEX_NEW
        - COUNTRY
      properties:
        INDEX_NAME:
          type: string
          description: Human-readable index name.
          example: "CPI – All Urban Consumers – Midwest Region"
        INDEX_CODE:
          type: string
          description: Source-specific code identifying the index.
          example: "CUUR0200SA0"
        INDEX_AS_OF:
          type: string
          description: "Index 'as of' date in MM/DD/YYYY."
          example: "02/11/2020"
        INDEX_NEW:
          type: number
          description: Current period index value.
          example: 101.00000
        COUNTRY:
          type: string
          description: ISO 3166-1 alpha-3 country code.
          example: "USA"
        CREATION_DATE:
          type: string
          description: "MM/DD/YYYY."
        CREATED_BY:
          type: string
          description: "Defaults to `integration` for automated rows."
