openapi: 3.1.0
info:
  title: Tango Space Department Hierarchy Inbound — File
  version: "0.5"
  description: |
    SFTP file-based inbound. Client drops a pipe-delimited file of Department
    records on Tango's SFTP server. Tango creates/updates Department records
    (under Building → Navigation → Department Hierarchy). Inactivation via
    status; Tango never deletes.

    Upsert key: `COST_CENTER`. Department Name must be unique.
  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}_dept_MMDDYYYYHHMMSS.txt"
servers:
  - url: sftp://sftp.tangoanalytics.com
    description: Production SFTP
    x-environment: production
    x-path: /inbound/dept
  - url: sftp://sftpdev.tangoanalytics.com
    description: Test SFTP (SIT/UAT)
    x-environment: test
    x-path: /inbound/dept
tags: [{name: Department Hierarchy File}]
paths:
  /inbound/dept:
    post:
      summary: Drop Department hierarchy file at SFTP path
      operationId: deliverDepartmentFile
      tags: [Department Hierarchy File]
      requestBody:
        required: true
        content:
          text/plain:
            schema:
              type: string
              format: binary
              x-record-schema:
                $ref: "#/components/schemas/DepartmentRow"
      responses:
        "200":
          description: File received and queued.
components:
  securitySchemes:
    sftpUserPassword:
      type: http
      scheme: basic
      description: "Source lists username `tango_dev`, password TBD."
  schemas:
    DepartmentRow:
      type: object
      required:
        - CLIENT_ID
        - COST_CENTER
        - DEPARTMENT_NAME
        - TYPE
        - PARENT_TYPE
        - STATUS
      properties:
        CLIENT_ID: { type: string, description: "Tango client identifier.", example: "97" }
        COST_CENTER: { type: string, description: "Upsert key.", example: "0100000153" }
        DEPARTMENT_NAME: { type: string, description: "Must be unique.", example: "0100000153-Marketing" }
        TYPE: { type: string, description: "Department Type. Lookup (DEPARTMENT_TYPE)." }
        PARENT_COST_CENTER: { type: string, example: "153" }
        PARENT_TYPE: { type: string }
        STATUS: { type: string, description: "Lookup (STATUS).", example: "ACTIVE" }
        C_EXT_ATTR1: { type: string }
        C_EXT_ATTR2: { type: string }
        C_EXT_ATTR3: { type: string }
        C_EXT_ATTR4: { type: string }
        C_EXT_ATTR5: { type: string }
        C_EXT_ATTR6: { type: string }
        C_EXT_ATTR7: { type: string }
        C_EXT_ATTR8: { type: string }
        C_EXT_ATTR9: { type: string }
        C_EXT_ATTR10: { type: string }
        C_EXT_LOV1: { type: string }
        C_EXT_LOV2: { type: string }
        C_EXT_LOV3: { type: string }
        C_EXT_LOV4: { type: string }
        C_EXT_LOV5: { type: string }
        D_EXT_ATTR1: { type: string, description: "DATE." }
        D_EXT_ATTR2: { type: string, description: "DATE." }
        D_EXT_ATTR3: { type: string, description: "DATE." }
        D_EXT_ATTR4: { type: string, description: "DATE." }
        D_EXT_ATTR5: { type: string, description: "DATE." }
        N_EXT_ATTR1: { type: number }
        N_EXT_ATTR2: { type: number }
        N_EXT_ATTR3: { type: number }
        N_EXT_ATTR4: { type: number }
        N_EXT_ATTR5: { type: number }
security:
  - sftpUserPassword: []
