openapi: 3.1.0
info:
  title: Tango Space HR Outbound API
  version: "0.9"
  description: |
    Async **delta** REST API: client retrieves Person/HR records (with
    associated space/area/floor/building/property assignments) from Tango
    since the last integration run. Active records only. Two-call pattern
    with gu_id polling.

    Records include people assigned to spaces/areas AND people not assigned
    to any space. Locations are listed per person — one person may have
    multiple location assignments.
  x-direction: outbound
  x-source: Tango
  x-destination: Client System
servers:
  - url: https://api.tangoanalytics.com
    description: Production
  - url: https://testapi.tangoanalytics.com
    description: Test (SIT/UAT)
tags: [{name: People HR (Delta)}, {name: Status}]
paths:
  /v1/spacemgmt/batch/people:
    get:
      summary: Initiate delta People export (async)
      operationId: getPeopleHrDelta
      tags: [People HR (Delta)]
      parameters:
        - $ref: "#/components/parameters/XClient"
        - $ref: "#/components/parameters/XApiKey"
      responses:
        "200":
          description: Async ack.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AcceptedResponse"
  /v1/batch/status:
    get:
      summary: Retrieve paginated People records by gu_id
      operationId: getPeopleHrByGuId
      tags: [Status]
      parameters:
        - $ref: "#/components/parameters/XClient"
        - $ref: "#/components/parameters/XApiKey"
        - in: query
          name: gu_id
          required: true
          schema: { type: string, format: uuid }
      responses:
        "200":
          description: People records.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PersonPage"
components:
  securitySchemes:
    xClientHeader: { type: apiKey, in: header, name: x-client }
    xApiKeyHeader: { type: apiKey, in: header, name: x-api-key }
  parameters:
    XClient: { name: x-client, in: header, required: true, schema: { type: string } }
    XApiKey: { name: x-api-key, in: header, required: true, schema: { type: string } }
  schemas:
    AcceptedResponse:
      type: object
      required: [status]
      properties:
        status: { type: string, enum: [OK, Error] }
        status_message: { type: string }
        gu_id: { type: string, format: uuid }
    PersonPage:
      type: object
      required: [records]
      properties:
        status: { type: string, enum: [PROCESSING, COMPLETED, ERROR] }
        total_records: { type: integer }
        total_pages: { type: integer }
        page_size: { type: integer, default: 5000 }
        page_no: { type: integer }
        records:
          type: array
          items:
            $ref: "#/components/schemas/PersonRecord"
    PersonRecord:
      type: object
      description: |
        Person with optional location assignment(s). A person not assigned to
        any space still appears (location fields will be empty/omitted).
      properties:
        person_id: { type: number }
        first_name: { type: string }
        last_name: { type: string }
        person_number: { type: string }
        employee_type: { type: string }
        middle_name: { type: string }
        other_name: { type: string }
        cost_center: { type: string }
        title: { type: string }
        manager_number: { type: number }
        shift_worker: { type: string, enum: [Y, N] }
        status: { type: string }
        country: { type: string }
        hire_date: { type: string, description: "DATE." }
        end_date: { type: string, description: "DATE." }
        grade_level: { type: string }
        work_from_home: { type: string, enum: [Y, N] }
        primary_phone: { type: string }
        mobile_number: { type: string }
        email: { type: string, format: email }
        cattr1: { type: string }
        cattr2: { type: string }
        cattr3: { type: string }
        cattr4: { type: string }
        cattr5: { type: string }
        cattr6: { type: string }
        cattr7: { type: string }
        cattr8: { type: string }
        cattr9: { type: string }
        cattr10: { type: string }
        nattr1: { type: number }
        nattr2: { type: number }
        nattr3: { type: number }
        nattr4: { type: number }
        nattr5: { type: number }
        dattr1: { type: string, description: "DATE." }
        dattr2: { type: string, description: "DATE." }
        dattr3: { type: string, description: "DATE." }
        dattr4: { type: string, description: "DATE." }
        dattr5: { type: string, description: "DATE." }
        lovattr1: { type: string }
        lovattr2: { type: string }
        lovattr3: { type: string }
        lovattr4: { type: string }
        lovattr5: { type: string }
        brand_id: { type: number }
        seating_type: { type: string }
        zip_code: { type: string }
        mac_addresses: { type: string, description: "Comma-separated." }
        usernames: { type: string, description: "Comma-separated." }
        hostnames: { type: string, description: "Comma-separated." }
        # Location assignment fields
        property_number: { type: string }
        property_name: { type: string }
        store_number: { type: string }
        store_name: { type: string }
        floor_number: { type: string }
        floor_name: { type: string }
        space_number: { type: string }
        space_name: { type: string }
        space_type: { type: string }
        space_use: { type: string }
        shift_space: { type: string, enum: [Y, N] }
        area_type: { type: string }
        area_number: { type: string }
        area_name: { type: string }
        flexible_seating: { type: string, enum: [Y, N] }
        display_name: { type: string }
        allocation_type: { type: string, description: 'e.g., "Automatic".' }
security:
  - xClientHeader: []
    xApiKeyHeader: []
