openapi: 3.0.4
info:
  title: WHISKY:EDITION API
  description: Oeffentliche API fuer Whisky-Testberichte, Tasting Notes und Metadaten von WHISKY:EDITION.
  version: 1.0.0
servers:
  - url: https://whiskyedition.de
paths:
  /api/whisky-testberichte:
    get:
      summary: Liste der Whisky-Testberichte
      parameters:
        - name: page
          in: query
          required: false
          description: Seite der Ergebnisliste
          schema:
            type: integer
            default: 1
        - name: per_page
          in: query
          required: false
          description: Anzahl der Testberichte pro Seite
          schema:
            type: integer
            default: 24
        - name: q
          in: query
          required: false
          description: Volltextsuche ueber Titel, Beschreibung und Metadaten
          schema:
            type: string
        - name: country
          in: query
          required: false
          schema:
            type: string
        - name: region
          in: query
          required: false
          schema:
            type: string
        - name: distillery
          in: query
          required: false
          schema:
            type: string
        - name: bottler
          in: query
          required: false
          schema:
            type: string
        - name: flavour
          in: query
          required: false
          schema:
            type: string
        - name: type
          in: query
          required: false
          schema:
            type: string
        - name: min_age
          in: query
          required: false
          schema:
            type: number
        - name: max_age
          in: query
          required: false
          schema:
            type: number
        - name: min_abv
          in: query
          required: false
          schema:
            type: number
        - name: max_abv
          in: query
          required: false
          schema:
            type: number
        - name: min_price
          in: query
          required: false
          schema:
            type: number
        - name: max_price
          in: query
          required: false
          schema:
            type: number
      responses:
        '200':
          description: Liste veroeffentlichter Whisky-Testberichte
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/List'
  /api/whisky-testberichte/{slug}:
    get:
      summary: Detaillierte Informationen zu einem einzelnen Whisky-Testbericht
      parameters:
        - name: slug
          in: path
          required: true
          description: slug
          schema:
            type: string
      responses:
        '200':
          description: details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Detail'
        '404':
          description: Whisky-Testbericht nicht gefunden
components:
  schemas:
    List:
      type: object
      required: [ok, lang, count, total, page, per_page, items]
      properties:
        ok:
          type: boolean
        lang:
          type: string
          enum: [de, en]
        count:
          type: integer
        total:
          type: integer
        page:
          type: integer
        per_page:
          type: integer
        items:
          type: array
          items:
            $ref: '#/components/schemas/Summary'
    Summary:
      type: object
      required: [id, slug, lang, name, description, image, authors, metadata, rating, url]
      properties:
        id:
          type: integer
        slug:
          type: string
        lang:
          type: string
          enum: [de, en]
        name:
          type: string
        description:
          type: string
        image:
          type: object
          required: [url]
          properties:
            url:
              type: string
              format: uri
            alt:
              type: string
        authors:
          type: array
          items:
            type: string
            enum: [Marcel, Sascha]
        published_at:
          type: string
          format: date-time
          nullable: true
        metadata:
          $ref: '#/components/schemas/MetaData'
        rating:
          $ref: '#/components/schemas/Rating'
        url:
          type: string
    Detail:
      allOf:
        - $ref: '#/components/schemas/Summary'
        - type: object
      required: [tasting_notes, conclusion]
      properties:
        tasting_notes:
          $ref: '#/components/schemas/Notes'
        conclusion:
          $ref: '#/components/schemas/Conclusion'
        faq:
          type: array
          items:
            type: object
            required: [question, answer]
                properties:
                  question:
                    type: string
                  answer:
                    type: string
    MetaData:
      type: object
      required: [type, country, distillery, abv]
      properties:
        type:
          type: string
        country:
          type: string
        region:
          type: string
        distillery:
          type: string
        bottler:
          type: string
        age:
          type: integer
        abv:
          type: number
        price_per_liter:
          type: number
        flavour:
          type: string
        provided_by:
          type: string
    Rating:
      type: object
      required: [marcel, sascha, value_for_money]
      properties:
        marcel:
          type: number
          minimum: 0
          maximum: 100
        sascha:
          type: number
          minimum: 0
          maximum: 100
        value_for_money:
          type: integer
          minimum: 1
          maximum: 5
    Notes:
      type: object
      required: [nose, palate, finish]
      properties:
        nose:
          type: string
        palate:
          type: string
        finish:
          type: string
    Conclusion:
      type: object
      required: [marcel, sascha]
      properties:
        marcel:
          type: string
        sascha:
          type: string
