openapi: 3.0.0
info:
  title: Spotlight Event Api
  version: 1.0.5
servers:
  - url: https://dev.ibiza-spotlight.com/shop/tickets/api
    description: For testing
  - url: https://www.ibiza-spotlight.com/shop/tickets/api
    description: For live

paths:
  /events:
    post:
      summary: return array of events
      description: |
        Fetches events and tickets according to parametres sent
      requestBody:
        required: false
        content:
          application/json:
            examples:
              byDates:
                summary: Either all events for a date range. Only valid for this year. Maximum 7 days / Or a single event by id / or all events per venue
                value:
                  dateFrom: yyyy-mm-dd
                  dateTo: yyyy-mm-dd
                  eventId: integer
                  venueId: integer
      responses:
        200:
          description: events and tickets for which this user has permission
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Event'
        401:
          description: |
            Error - hopefully there is info in the response.
            If not send out the bat signal.

components:
  schemas:
    Event:
      type: object
      required:
      - eventId
      - title
      - start
      - end
      - djs
      - promoter
      - venue
      - tickets
      properties:
        eventId:
          type: integer
          example: 12345
        title:
          type: string
          example: Pacha Opening Party
        start:
          type: string
          format: date-time
          example: yyyy-mm-dd H:i:s
        end:
          type: string
          format: date-time
          example: yyyy-mm-dd H:i:s
        djs:
          type: object
        promoter:
          type: object
          properties:
            id:
              type: integer
            title:
              type: string
            alias:
              type: string
              description: link to venue page in Spotlight
            logo:
              type: string
              description: link to logo src
        venue:
          type: object
          properties:
            id:
              type: integer
            title:
              type: string
            alias:
              type: string
              description: link to venue page in Spotlight
            logo:
              type: string
              description: link to logo src
        tickets:
          type: array
          items:
            type: object
            properties:
              title:
                type: string
              price:
                type: integer
              cutoff:
                type: integer
                description: timestamp of the latest time possible to purchase tickets before the event

    ApiKey:
      type: string
      description: |
        random string, should be sent with every request as the header: Authorization: Bearer {ApiKey}
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: ApiKey
security:
  - bearerAuth: []
