# OpenAPI contract addition for GET /events/{token}
# To be merged into backend/src/main/resources/openapi/api.yaml

paths:
  /events/{token}:
    get:
      operationId: getEvent
      summary: Get public event details by token
      tags:
        - events
      parameters:
        - name: token
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Public event token
      responses:
        "200":
          description: Event found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetEventResponse"
        "404":
          description: Event not found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetail"

components:
  schemas:
    GetEventResponse:
      type: object
      required:
        - eventToken
        - title
        - dateTime
        - timezone
        - attendeeCount
        - expired
      properties:
        eventToken:
          type: string
          format: uuid
          description: Public event token
          example: "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
        title:
          type: string
          description: Event title
          example: "Summer BBQ"
        description:
          type: string
          description: Event description (absent if not set)
          example: "Bring your own drinks!"
        dateTime:
          type: string
          format: date-time
          description: Event date/time with organizer's UTC offset
          example: "2026-03-15T20:00:00+01:00"
        timezone:
          type: string
          description: IANA timezone name of the organizer
          example: "Europe/Berlin"
        location:
          type: string
          description: Event location (absent if not set)
          example: "Central Park, NYC"
        attendeeCount:
          type: integer
          minimum: 0
          description: Number of confirmed attendees (attending=true)
          example: 12
        expired:
          type: boolean
          description: Whether the event's expiry date has passed
          example: false

    # Modification to existing CreateEventRequest — add timezone field
    # CreateEventRequest (additions):
    #   timezone:
    #     type: string
    #     description: IANA timezone of the organizer
    #     example: "Europe/Berlin"
    #   (make required)

    # Modification to existing CreateEventResponse — add timezone field
    # CreateEventResponse (additions):
    #   timezone:
    #     type: string
    #     description: IANA timezone of the organizer
    #     example: "Europe/Berlin"
