openapi: 3.1.0
info:
  title: calendarService API (GPT-ready)
  version: 1.0.0
servers:
  - url: https://calendar.agentflux.dev
security:
  - sessionToken: []
paths:
  /api/healthz:
    get:
      operationId: getHealth
      summary: Health check
      responses:
        "200":
          description: OK
  /api/events:
    get:
      operationId: listEvents
      summary: List upcoming events
      parameters:
        - in: query
          name: limit
          schema:
            type: integer
            minimum: 1
            default: 10
        - in: query
          name: time_min
          schema:
            type: string
            format: date-time
      responses:
        "200":
          description: Events
    post:
      operationId: createEvent
      summary: Create an event
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/EventCreate"
      responses:
        "201":
          description: Created
  /api/events/{id}:
    get:
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      operationId: getEvent
      summary: Get an event by id
      responses:
        "200":
          description: Event
    put:
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      operationId: updateEvent
      summary: Update an event
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/EventCreate"
      responses:
        "200":
          description: Updated
    delete:
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
      operationId: deleteEvent
      summary: Delete an event
      responses:
        "204":
          description: Deleted
components:
  securitySchemes:
    sessionToken:
      type: apiKey
      in: header
      name: X-Session-Token
  schemas:
    EventCreate:
      type: object
      required:
        - summary
        - start_time
        - end_time
        - time_zone
      properties:
        summary:
          type: string
        description:
          type: string
        start_time:
          type: string
          format: date-time
        end_time:
          type: string
          format: date-time
        time_zone:
          type: string
