openapi: 3.1.0
info:
  title: Tango Space Property Outbound API
  version: "1.0"
  description: |
    Async **delta** REST API: client retrieves Property records updated in
    Tango since the last integration run. Two-call pattern with gu_id and
    pagination (5000/page). Updates to `property_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://uspstestapi.tangoanalytics.com
    description: "Test (USPS-specific test host per source — likely placeholder)."
tags: [{name: Properties (Delta)}, {name: Status}]
paths:
  /v1/spacemgmt/delta/properties:
    get:
      summary: Initiate delta Property export (async)
      operationId: getPropertiesDelta
      tags: [Properties (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 Property records by gu_id
      operationId: getPropertiesByGuId
      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/PropertyPage"
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 }
    PropertyPage:
      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/PropertyRecord"
    PropertyRecord:
      type: object
      properties:
        property_id: { type: number }
        property_name: { type: string }
        property_number: { type: string }
        property_desc: { type: string }
        property_type: { type: string }
        latitude: { type: number }
        longtitude:
          type: number
          description: |
            **Typo in source** — should be `longitude`. Source data-mapping
            table lists `longtitude`; preserved verbatim. Confirm wire format.
        status: { type: string, description: 'Sample: "ACTIVE".' }
        address: { type: string, description: 'Client Label "Address1".' }
        Address2:
          type: string
          description: |
            **Casing inconsistency** — source mapping uses PascalCase
            `Address2` while sibling `address` is lowercase. Preserved verbatim.
        city: { type: string }
        state: { type: string }
        county: { type: string }
        country: { type: string }
        zip: { type: string }
        cad_rentable_sf: { type: number }
        lease_rentable_sf: { type: number }
        usable_sf: { type: number }
        actual_sf: { type: number }
        property_common_sf: { type: number }
        building_common_sf: { type: number }
        floor_common_sf: { type: number }
        Residual_sf:
          type: number
          description: "Casing inconsistency — `Residual_sf` (capital R) in source mapping."
        Owned:
          type: number
          description: 'Y/N flag (typed NUMBER but used as boolean indicator). Client Label "Owned?".'
        Subleased:
          type: number
          description: 'Y/N flag. Client Label "Subleased?".'
        total_head_count: { type: number }
        workstation_head_count: { type: number }
        total_capacity: { type: number }
        workstation_capacity: { type: number }
        last_update_date: { type: string, description: "TIMESTAMP." }
        last_updated_by: { type: string }
security:
  - xClientHeader: []
    xApiKeyHeader: []
