---
openapi: "3.0.0"
info:
  version: "1.0.0"
  title: "Chill api"
  description: "Api documentation for chill. Currently, work in progress"
servers:
  - url: "/api"
    description: "Your current dev server"

components:
  schemas:
    Thirdparty:
      type: object
      properties:
        id:
          type: integer
          readOnly: true
        type:
          type: string
          enum:
            - "thirdparty"
        firstname:
          type: string
        name:
          type: string
        email:
          type: string
        telephone:
          type: string
        telephone2:
          type: string
        address:
          $ref: "#/components/schemas/Address"
    Address:
      type: object
      properties:
        id:
          type: integer


paths:
  /1.0/thirdparty/thirdparty.json:
    post:
      tags:
        - thirdparty
      summary: Create a single thirdparty
      requestBody:
        description: "A thirdparty"
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Thirdparty"
      responses:
        200:
          description: "OK"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Thirdparty"
        403:
          description: "Unauthorized"
        422:
          description: "Invalid data"

  /1.0/thirdparty/thirdparty/{id}.json:
    get:
      tags:
        - thirdparty
      summary: Return a thirdparty item by id
      parameters:
        - name: id
          in: path
          required: true
          description: The thirdparty id
          schema:
            type: integer
            format: integer
            minimum: 1
      responses:
        200:
          description: "ok"
        404:
          description: "not found"
        401:
          description: "Unauthorized"
    patch:
      tags:
        - thirdparty
      summary: "Alter a thirdparty"
      parameters:
        - name: id
          in: path
          required: true
          description: The thirdparty's id
          schema:
            type: integer
            format: integer
            minimum: 1
      requestBody:
        description: "A thirdparty"
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Thirdparty"
      responses:
        401:
          description: "Unauthorized"
        404:
          description: "Not found"
        200:
          description: "OK"
        422:
          description: "Object with validation errors"
