openapi: 3.1.0
info:
  title: Tango Vendor One-to-Many Inbound — File
  version: "0.4"
  description: |
    SFTP file-based inbound for clients where one supplier has many sites.
    Each pipe-delimited row carries BOTH supplier-level fields
    (`Supplier_number`, `Supplier_name`, `Supplier_Status`,
    `Supplier_Address1..3`, etc.) AND site-level fields
    (`Supplier_Site_Number`, `supplier_site_name`, `address_1..3`, etc.).

    Multiple rows with the same `Supplier_number` represent multiple sites
    for that supplier. Same SFTP path (`/inbound/vendor`) and naming
    convention as the standard Vendor file — Tango disambiguates by file
    content shape.
  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}_Vendor_MMDDYYYYHHMMSS.txt"
servers:
  - url: sftp://sftp.tangoanalytics.com
    description: Production SFTP
    x-environment: production
    x-path: /inbound/vendor
  - url: sftp://sftpdev.tangoanalytics.com
    description: Test SFTP (SIT/UAT)
    x-environment: test
    x-path: /inbound/vendor
tags:
  - name: Vendor One-to-Many File
paths:
  /inbound/vendor:
    post:
      summary: Drop one-to-many vendor file at SFTP path
      operationId: deliverVendorOneToManyFile
      tags: [Vendor One-to-Many File]
      requestBody:
        required: true
        content:
          text/plain:
            schema:
              type: string
              format: binary
              x-record-schema:
                $ref: "#/components/schemas/VendorOneToManyRow"
      responses:
        "200":
          description: File received and queued for processing.
components:
  securitySchemes:
    sftpUserPassword:
      type: http
      scheme: basic
  schemas:
    VendorOneToManyRow:
      type: object
      description: |
        One row per supplier-site combination. Multiple rows with the same
        Supplier_number represent multiple sites for that supplier. Field
        casing is preserved from source — supplier-level fields use
        PascalCase (Supplier_Address1, Supplier_City, etc.) while
        site-level fields use snake_case (address_1, city, etc.).
      required:
        - client_id
        - Supplier_number
        - Supplier_name
        - Supplier_Status
        - Supplier_Country
        - supplier_type
        - Supplier_Site_Number
        - supplier_site_name
        - supplier_site_type
        - Primary_site
        - country
        - is_payee
      properties:
        client_id:
          type: number
          description: Tango client identifier.
        Supplier_number:
          type: string
          description: Unique vendor number (supplier level).
        Supplier_name: { type: string }
        Supplier_Status:
          type: string
          enum: [A, I]
        Supplier_Address1: { type: string }
        Supplier_Address2: { type: string }
        Supplier_City: { type: string }
        Supplier_State: { type: string }
        Supplier_Zip: { type: string }
        Supplier_Country:
          type: string
          description: 3-letter country code.
        supplier_type:
          type: string
          enum: [LEASE, PROJECT, ALL]
        Supplier_Site_Number:
          type: string
          description: Per-site number.
        supplier_site_name:
          type: string
          description: Client label "Vendor Name".
        supplier_site_type:
          type: string
          description: Client-defined (Lessee, Payee, Tenant, etc.).
        Primary_site:
          type: string
          enum: [Y, N]
        address_1: { type: string, description: "Site address 1." }
        address_2: { type: string, description: "Site address 2." }
        address_3: { type: string, description: "Site address 3." }
        city: { type: string, description: "Site city." }
        state: { type: string, description: "Site state." }
        zip: { type: string, description: "Site zip." }
        country:
          type: string
          description: "Site country (3-letter ISO)."
        is_payee:
          type: string
          enum: [Y, N]
security:
  - sftpUserPassword: []
