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

paths:
  /events/{eventToken}/rsvps:
    post:
      operationId: createRsvp
      summary: Submit an RSVP for an event
      tags:
        - events
      parameters:
        - name: eventToken
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Public event token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateRsvpRequest"
      responses:
        "201":
          description: RSVP created successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreateRsvpResponse"
        "400":
          description: Validation failed (e.g. blank name)
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ValidationProblemDetail"
        "404":
          description: Event not found
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetail"
        "409":
          description: Event has expired — RSVPs no longer accepted
          content:
            application/problem+json:
              schema:
                $ref: "#/components/schemas/ProblemDetail"

components:
  schemas:
    CreateRsvpRequest:
      type: object
      required:
        - name
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 100
          description: Guest's display name
          example: "Max Mustermann"

    CreateRsvpResponse:
      type: object
      required:
        - rsvpToken
        - name
      properties:
        rsvpToken:
          type: string
          format: uuid
          description: Token identifying this RSVP (store client-side for future updates)
          example: "d4e5f6a7-b8c9-0123-4567-890abcdef012"
        name:
          type: string
          description: Guest's display name as stored
          example: "Max Mustermann"
