openapi: 3.1.0
info:
  title: Tango Space Area Outbound API
  version: "1.0"
  description: |
    Async **delta** REST API: client retrieves Space Area records updated
    in Tango since the last integration run. Two-call pattern with gu_id
    and pagination (5000/page). Updates to `space_area_id`, `building_id`,
    or `floor_id` do NOT trigger export.
  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: Space Areas (Delta)}, {name: Status}]
paths:
  /v1/spacemgmt/delta/areas:
    get:
      summary: Initiate delta Space Area export (async)
      operationId: getSpaceAreasDelta
      tags: [Space Areas (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 Space Area records by gu_id
      operationId: getSpaceAreasByGuId
      tags: [Status]
      parameters:
        - $ref: "#/components/parameters/XClient"
        - $ref: "#/components/parameters/XApiKey"
        - in: query
          name: gu_id
          required: true
          schema: { type: string, format: uuid }
        - in: query
          name: page_no
          required: false
          schema: { type: integer, minimum: 1 }
      responses:
        "200":
          description: Paginated records.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SpaceAreaPage"
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 }
    SpaceAreaPage:
      type: object
      required: [status, 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/SpaceAreaRecord"
    SpaceAreaRecord:
      type: object
      properties:
        space_area_id: { type: number }
        building_id: { type: number }
        building_number:
          type: number
          description: |
            Source mapping types as NUMBER but sample is `"1234"` (string).
            Schema follows mapping.
        floor_id: { type: number }
        floor_number:
          type: number
          description: 'Source typed NUMBER; sample `"05"` (string with leading zero).'
        property_number:
          type: number
          description: 'Source typed NUMBER; sample `"REGION 2"` (string).'
        area_name: { type: string }
        area_number: { type: string }
        area_type: { type: string, description: 'Sample: "Flexible Seating".' }
        mac_enabled: { type: string, enum: [Y, N] }
        is_flexible_seating: { type: string, enum: [Y, N] }
        lease_rentable_sf: { type: number, description: "Rentable square feet." }
        allocation_type: { type: string, description: 'Sample: "People Allocation".' }
        is_shift_seating: { type: string, enum: [Y, N] }
        number_of_shifts:
          type: number
          description: 'Source mapping types as VARCHAR; sample is numeric `2`.'
        shift_length:
          type: number
          description: 'Source mapping types as VARCHAR; sample is numeric `8`.'
        country: { type: string }
        status: { type: string }
        space_count: { type: number }
        headcount: { type: number }
        max_occupancy: { type: number }
        flex_occupancy: { type: number }
        current_occupancy: { type: number }
        available_occupancy: { type: number }
        last_update_date: { type: string, description: "TIMESTAMP." }
        last_updated_by: { type: string }
security:
  - xClientHeader: []
    xApiKeyHeader: []
