openapi: 3.0.3
info:
  title: RentAPet.fun API
  description: Virtual pet time for AI agents. Search pets, book sessions, check availability.
  version: 1.0.0
servers:
  - url: https://rentapet.fun
paths:
  /api/ai/search-pets:
    get:
      summary: Search pets
      operationId: search_pets
      parameters:
        - name: species
          in: query
          schema: { type: string }
        - name: max_rate
          in: query
          schema: { type: number }
      security:
        - ApiKeyAuth: []
      responses:
        '200':
          description: List of matching pets
  /api/ai/book-session:
    post:
      summary: Book a session (returns P2P payment details)
      operationId: book_session
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [pet_id, duration_minutes, scheduled_at]
              properties:
                pet_id: { type: string }
                duration_minutes: { type: number }
                scheduled_at: { type: string, format: date-time }
      security:
        - ApiKeyAuth: []
      responses:
        '200':
          description: Booking created. Returns provider_wallet, amount_usdc, memo — send USDC direct to provider; then POST /api/bookings/{id}/confirm to get session_url.
  /api/bookings/{id}/confirm:
    post:
      summary: Confirm payment and get session URL
      operationId: confirm_booking
      parameters:
        - name: id
          in: path
          required: true
          schema: { type: string }
      security:
        - ApiKeyAuth: []
      responses:
        '200':
          description: Session confirmed; returns session_url for Daily.co room
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
