openapi: 3.0.3
info:
  title: Connect & Integrate API (PoC sample)
  description: |
    Fictional subset of the Connect & Integrate REST API for demonstrating
    embedded OpenAPI documentation in Starlight. Not a production contract.
  version: 1.0.0-poc
  contact:
    name: DIH Platform
    email: DIH_Sales@telekom.de
servers:
  - url: https://api.dev.dih-cloud.com/connect/v1
    description: Development
  - url: https://api.dih.telekom.com/connect/v1
    description: Production
tags:
  - name: Assets
    description: Digital product passports and asset metadata
  - name: Transfers
    description: Data exchange between connectors
paths:
  /assets:
    get:
      tags: [Assets]
      summary: List assets
      operationId: listAssets
      parameters:
        - name: page
          in: query
          schema:
            type: integer
            minimum: 1
            default: 1
        - name: pageSize
          in: query
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 20
      responses:
        '200':
          description: Paginated asset list
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AssetList'
        '401':
          $ref: '#/components/responses/Unauthorized'
    post:
      tags: [Assets]
      summary: Register an asset
      operationId: createAsset
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateAssetRequest'
      responses:
        '201':
          description: Asset created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Asset'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /assets/{assetId}:
    get:
      tags: [Assets]
      summary: Get asset by ID
      operationId: getAsset
      parameters:
        - $ref: '#/components/parameters/AssetId'
      responses:
        '200':
          description: Asset details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Asset'
        '404':
          description: Asset not found
  /transfers:
    post:
      tags: [Transfers]
      summary: Initiate a data transfer
      operationId: createTransfer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateTransferRequest'
      responses:
        '202':
          description: Transfer accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Transfer'
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  parameters:
    AssetId:
      name: assetId
      in: path
      required: true
      schema:
        type: string
        format: uuid
  responses:
    Unauthorized:
      description: Missing or invalid bearer token
  schemas:
    Asset:
      type: object
      required: [id, name, createdAt]
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        createdAt:
          type: string
          format: date-time
    AssetList:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/Asset'
        total:
          type: integer
    CreateAssetRequest:
      type: object
      required: [name]
      properties:
        name:
          type: string
    CreateTransferRequest:
      type: object
      required: [sourceConnectorId, targetConnectorId, payloadRef]
      properties:
        sourceConnectorId:
          type: string
        targetConnectorId:
          type: string
        payloadRef:
          type: string
    Transfer:
      type: object
      properties:
        id:
          type: string
          format: uuid
        status:
          type: string
          enum: [pending, running, completed, failed]
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
security:
  - bearerAuth: []
