openapi: "3.0.3"
info:
  title: "Internal platform services API"
  version: "1.0.0"
  description: "service_dependencies is a self-referencing table, so a naive depth-first generator can emit a cycle and deadlock the insert. The kind column distinguishes a blocking call from a queue publish, and the two have different rollback behaviour. A deploy row records success as a zero-or-one integer rather than a boolean, because the deploy bot writes it directly. Services are tiered, and tier1 services have a stricter change window that the API returns as a separate field."
paths: {}
x-domain-id: "platform"
x-dialect: "postgres"
components:
  schemas:
    services:
      type: "object"
      x-primary-key: "id"
      required: ["id", "slug", "owner_team", "tier"]
      properties:
        id:
          type: "string"
          format: "uuid"
        slug:
          type: "string"
          x-unique: true
        owner_team:
          type: "string"
        tier:
          type: "string"
          enum: ["tier1", "tier2", "tier3"]
    service_dependencies:
      type: "object"
      x-primary-key: "id"
      required: ["id", "service_id", "depends_on_id", "kind"]
      properties:
        id:
          type: "string"
          format: "uuid"
        service_id:
          $ref: "#/components/schemas/services"
        depends_on_id:
          $ref: "#/components/schemas/services"
        kind:
          type: "string"
          enum: ["sync", "async"]
    deploys:
      type: "object"
      x-primary-key: "id"
      required: ["id", "service_id", "version", "deployed_at", "ok"]
      properties:
        id:
          type: "string"
          format: "uuid"
        service_id:
          $ref: "#/components/schemas/services"
        version:
          type: "string"
        deployed_at:
          type: "string"
          format: "date-time"
        ok:
          type: "integer"
          minimum: 0
          maximum: 1
