---
openapi: 3.0.3
info:
  title: API V1
  version: v1
paths:
  "/article_categories":
    get:
      summary: article categories
      tags:
      - Category
      parameters:
      - name: per_page
        in: query
        required: false
        schema:
          type: integer
      - name: page
        in: query
        required: false
        schema:
          type: integer
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                type: object
                properties:
                  article_categories:
                    type: array
                    items:
                      "$ref": "#/components/schemas/ArticleCategory"
        '401':
          description: not logged-in
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error401"
  "/article_categories/{id}":
    get:
      summary: find article category by id
      tags:
      - Category
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
      responses:
        '200':
          description: article category found
          content:
            application/json:
              schema:
                type: object
                properties:
                  article_categories:
                    type: array
                    items:
                      "$ref": "#/components/schemas/ArticleCategory"
        '401':
          description: not logged-in
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error401"
        '404':
          description: not found
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error404"
  "/config":
    get:
      summary: configuration variables
      tags:
      - General
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                type: object
                properties: {}
        '401':
          description: not logged-in
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error401"
        '403':
          description: missing scope
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error403"
  "/financial_transaction_classes":
    get:
      summary: financial transaction classes
      tags:
      - Category
      parameters:
      - name: per_page
        in: query
        required: false
        schema:
          type: integer
      - name: page
        in: query
        required: false
        schema:
          type: integer
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                type: object
                properties:
                  meta:
                    "$ref": "#/components/schemas/Meta"
                  financial_transaction_class:
                    type: array
                    items:
                      "$ref": "#/components/schemas/FinancialTransactionClass"
        '401':
          description: not logged-in
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error401"
  "/financial_transaction_classes/{id}":
    get:
      summary: Retrieves a financial transaction class
      tags:
      - Category
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
      responses:
        '200':
          description: financial transaction class found
          content:
            application/json:
              schema:
                type: object
                properties:
                  financial_transaction_classes:
                    type: array
                    items:
                      "$ref": "#/components/schemas/FinancialTransactionClass"
        '401':
          description: not logged-in
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error401"
        '404':
          description: financial transaction class not found
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error404"
  "/financial_transaction_types":
    get:
      summary: financial transaction types
      tags:
      - Category
      parameters:
      - name: per_page
        in: query
        required: false
        schema:
          type: integer
      - name: page
        in: query
        required: false
        schema:
          type: integer
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                type: object
                properties:
                  meta:
                    "$ref": "#/components/schemas/Meta"
                  financial_transaction_type:
                    type: array
                    items:
                      "$ref": "#/components/schemas/FinancialTransactionType"
        '401':
          description: not logged-in
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error401"
  "/financial_transaction_types/{id}":
    get:
      summary: find financial transaction type by id
      tags:
      - Category
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
      responses:
        '200':
          description: financial transaction type found
          content:
            application/json:
              schema:
                type: object
                properties:
                  financial_transaction_types:
                    type: array
                    items:
                      "$ref": "#/components/schemas/FinancialTransactionType"
        '401':
          description: not logged-in
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error401"
        '404':
          description: financial transaction type not found
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error404"
  "/financial_transactions":
    get:
      summary: financial transactions
      tags:
      - Financial Transaction
      parameters:
      - name: per_page
        in: query
        required: false
        schema:
          type: integer
      - name: page
        in: query
        required: false
        schema:
          type: integer
      - name: include_incomplete
        in: query
        required: false
        schema:
          type: boolean
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                type: object
                properties:
                  meta:
                    "$ref": "#/components/schemas/Meta"
                  financial_transaction:
                    type: array
                    items:
                      "$ref": "#/components/schemas/FinancialTransaction"
        '401':
          description: not logged-in
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error401"
        '403':
          description: missing scope
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error403"
  "/financial_transactions/{id}":
    get:
      summary: 'Retrieves a financial transaction '
      tags:
      - Financial Transaction
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
      responses:
        '200':
          description: financial transaction found
          content:
            application/json:
              schema:
                type: object
                properties:
                  financial_transaction:
                    type: object
                    items:
                      "$ref": "#/components/schemas/FinancialTransaction"
        '401':
          description: not logged-in
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error401"
        '403':
          description: missing scope
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error403"
        '404':
          description: financial transaction not found
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error404"
  "/navigation":
    get:
      summary: navigation
      tags:
      - General
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                type: object
                properties:
                  navigation:
                    "$ref": "#/components/schemas/Navigation"
        '401':
          description: not logged-in
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error401"
  "/order_articles":
    get:
      summary: order articles
      tags:
      - Order
      parameters:
      - name: per_page
        in: query
        required: false
        schema:
          type: integer
      - name: page
        in: query
        required: false
        schema:
          type: integer
      - name: q
        in: query
        required: false
        description: "'member' show articles ordered by the user's ordergroup, 'all'
          by all members, and 'supplier' ordered at the supplier"
        schema:
          type: object
          properties:
            ordered:
              "$ref": "#/components/schemas/q_ordered"
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                type: object
                properties:
                  meta:
                    "$ref": "#/components/schemas/Meta"
                  order_articles:
                    type: array
                    items:
                      "$ref": "#/components/schemas/OrderArticle"
        '401':
          description: not logged-in
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error401"
        '403':
          description: missing scope
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error403"
  "/order_articles/{id}":
    get:
      summary: order articles
      tags:
      - Order
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                type: object
                properties:
                  order_article:
                    "$ref": "#/components/schemas/OrderArticle"
        '401':
          description: not logged-in
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error401"
        '403':
          description: missing scope
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error403"
        '404':
          description: order article not found
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error404"
  "/orders":
    get:
      summary: orders
      tags:
      - Order
      parameters:
      - name: per_page
        in: query
        required: false
        schema:
          type: integer
      - name: page
        in: query
        required: false
        schema:
          type: integer
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                type: object
                properties:
                  meta:
                    "$ref": "#/components/schemas/Meta"
                  ordes:
                    type: array
                    items:
                      "$ref": "#/components/schemas/Order"
        '401':
          description: not logged-in
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error401"
        '403':
          description: missing scope
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error403"
  "/orders/{id}":
    get:
      summary: Order
      tags:
      - Order
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                type: object
                properties:
                  order:
                    "$ref": "#/components/schemas/Order"
        '401':
          description: not logged-in
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error401"
        '403':
          description: missing scope
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error403"
        '404':
          description: order not found
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error404"
  "/user/financial_transactions":
    post:
      summary: create new financial transaction (requires enabled self service)
      tags:
      - Financial Transaction
      parameters: []
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                type: object
                properties:
                  financial_transaction:
                    "$ref": "#/components/schemas/FinancialTransaction"
        '401':
          description: not logged-in
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error401"
        '403':
          description: user has no ordergroup, is below minimum balance, self service
            is disabled, or missing scope
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error403"
        '404':
          description: financial transaction type not found
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error404"
        '422':
          description: invalid parameter value
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error422"
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                amount:
                  type: integer
                financial_transaction_type:
                  type: integer
                note:
                  type: string
    get:
      summary: financial transactions of the member's ordergroup
      tags:
      - User
      - Financial Transaction
      parameters:
      - name: per_page
        in: query
        required: false
        schema:
          type: integer
      - name: page
        in: query
        required: false
        schema:
          type: integer
      - name: include_incomplete
        in: query
        required: false
        schema:
          type: boolean
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                type: object
                properties:
                  meta:
                    "$ref": "#/components/schemas/Meta"
                  financial_transaction:
                    type: array
                    items:
                      "$ref": "#/components/schemas/FinancialTransaction"
        '401':
          description: not logged-in
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error401"
        '403':
          description: missing scope
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error403"
  "/user/financial_transactions/{id}":
    get:
      summary: find financial transaction by id
      tags:
      - User
      - Financial Transaction
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                type: object
                properties:
                  financial_transaction:
                    "$ref": "#/components/schemas/FinancialTransaction"
        '401':
          description: not logged-in
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error401"
        '403':
          description: user has no ordergroup or missing scope
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error403"
        '404':
          description: financial transaction not found
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error404"
  "/user/group_order_articles":
    get:
      summary: group order articles
      tags:
      - User
      - Order
      parameters:
      - name: per_page
        in: query
        required: false
        schema:
          type: integer
      - name: page
        in: query
        required: false
        schema:
          type: integer
      - name: q
        in: query
        required: false
        description: "'member' show articles ordered by the user's ordergroup, 'all'
          by all members, and 'supplier' ordered at the supplier"
        schema:
          type: object
          properties:
            ordered:
              "$ref": "#/components/schemas/q_ordered"
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                type: object
                properties:
                  meta:
                    "$ref": "#/components/schemas/Meta"
                  group_order_article:
                    type: array
                    items:
                      "$ref": "#/components/schemas/GroupOrderArticle"
        '401':
          description: not logged-in
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error401"
        '403':
          description: user has no ordergroup or missing scope
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error403"
    post:
      summary: create new group order article
      tags:
      - User
      - Order
      parameters: []
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                type: object
                properties:
                  group_order_article:
                    "$ref": "#/components/schemas/GroupOrderArticle"
                  order_article:
                    "$ref": "#/components/schemas/OrderArticle"
        '401':
          description: not logged-in
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error401"
        '403':
          description: user has no ordergroup, order not open, is below minimum balance,
            has not enough apple points, or missing scope
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error403"
        '404':
          description: order article not found in open orders
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error404"
        '422':
          description: invalid parameter value or group order article already exists
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error422"
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/GroupOrderArticleForCreate"
        required: true
        description: group order article to create
  "/user/group_order_articles/{id}":
    get:
      summary: find group order article by id
      tags:
      - User
      - Order
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                type: object
                properties:
                  group_order_article:
                    "$ref": "#/components/schemas/GroupOrderArticle"
                  order_article:
                    "$ref": "#/components/schemas/OrderArticle"
        '403':
          description: missing scope
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error403"
        '401':
          description: not logged-in
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error401"
        '404':
          description: group order article not found
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error404"
    patch:
      summary: update a group order article (but delete if quantity and tolerance
        are zero)
      tags:
      - User
      - Order
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                type: object
                properties:
                  group_order_article:
                    "$ref": "#/components/schemas/GroupOrderArticle"
        '401':
          description: not logged-in
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error401"
        '403':
          description: user has no ordergroup, order not open, is below minimum balance,
            has not enough apple points, or missing scope
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error403"
        '404':
          description: order article not found in open orders
          content:
            application/json:
              schema:
                type: object
                properties:
                  group_order_article:
                    "$ref": "#/components/schemas/GroupOrderArticle"
        '422':
          description: invalid parameter value
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error422"
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/GroupOrderArticleForUpdate"
        required: true
        description: group order article update
    delete:
      summary: remove group order article
      tags:
      - User
      - Order
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                type: object
                properties:
                  group_order_article:
                    "$ref": "#/components/schemas/GroupOrderArticle"
        '401':
          description: not logged-in
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error401"
        '403':
          description: user has no ordergroup, order not open, is below minimum balance,
            has not enough apple points, or missing scope
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error403"
        '404':
          description: order article not found in open orders
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error404"
  "/user":
    get:
      summary: info about the currently logged-in user
      tags:
      - User
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                type: object
                properties:
                  user:
                    type: object
                    properties:
                      id:
                        type: integer
                      name:
                        type: string
                        description: full name
                      email:
                        type: string
                        description: email address
                      locale:
                        type: string
                        description: language code
                    required:
                    - id
                    - name
                    - email
        '401':
          description: not logged-in
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error401"
        '403':
          description: missing scope
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error403"
  "/user/financial_overview":
    get:
      summary: financial summary about the currently logged-in user
      tags:
      - User
      - Financial Transaction
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                type: object
                properties:
                  financial_overview:
                    type: object
                    properties:
                      account_balance:
                        type: number
                        description: booked accout balance of ordergroup
                      available_funds:
                        type: number
                        description: fund available to order articles
                      financial_transaction_class_sums:
                        type: array
                        properties:
                          id:
                            type: integer
                            description: id of the financial transaction class
                          name:
                            type: string
                            description: name of the financial transaction class
                          amount:
                            type: number
                            description: sum of the amounts belonging to the financial
                              transaction class
                        required:
                        - id
                        - name
                        - amount
                    required:
                    - account_balance
                    - available_funds
                    - financial_transaction_class_sums
        '401':
          description: not logged-in
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error401"
        '403':
          description: missing scope
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Error403"
components:
  schemas:
    pagination:
      type: object
      properties:
        recordCount:
          type: integer
        pageCount:
          type: integer
        currentPage:
          type: integer
        pageSize:
          type: integer
      required:
      - recordCount
      - pageCount
      - currentPage
      - pageSize
    Order:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
          description: name of the order's supplier (or stock)
        starts:
          type: string
          format: date-time
          description: when the order was opened
        ends:
          type: string
          nullable: true
          format: date-time
          description: when the order will close or was closed
        boxfill:
          type: string
          nullable: true
          format: date-time
          description: when the order will enter or entered the boxfill phase
        pickup:
          type: string
          nullable: true
          format: date
          description: pickup date
        is_open:
          type: boolean
          description: if the order is currently open or not
        is_boxfill:
          type: boolean
          description: if the order is currently in the boxfill phase or not
    Article:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        supplier_id:
          type: integer
          description: id of supplier, or 0 for stock articles
        supplier_name:
          type: string
          nullable: true
          description: name of the supplier, or null for stock articles
        unit:
          type: string
          description: amount of each unit, e.g. "100 g" or "kg"
        unit_quantity:
          type: integer
          description: units can only be ordered from the supplier in multiples of
            unit_quantity
        note:
          type: string
          nullable: true
          description: generic note
        manufacturer:
          type: string
          nullable: true
          description: manufacturer
        origin:
          type: string
          nullable: true
          description: origin, preferably (starting with a) 2-letter ISO country code
        article_category_id:
          type: integer
          description: id of article category
        quantity_available:
          type: integer
          description: number of units available (only present on stock articles)
      required:
      - id
      - name
      - supplier_id
      - supplier_name
      - unit
      - unit_quantity
      - note
      - manufacturer
      - origin
      - article_category_id
    OrderArticle:
      type: object
      properties:
        id:
          type: integer
        order_id:
          type: integer
          description: id of order this order article belongs to
        price:
          type: number
          format: float
          description: foodcoop price
        quantity:
          type: integer
          description: number of units ordered by members
        tolerance:
          type: integer
          description: number of extra units that members are willing to buy to fill
            a box
        units_to_order:
          type: integer
          description: number of units to order from the supplier
        article:
          "$ref": "#/components/schemas/Article"
    ArticleCategory:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
      required:
      - id
      - name
    FinancialTransaction:
      allOf:
      - "$ref": "#/components/schemas/FinancialTransactionForCreate"
      - type: object
        properties:
          id:
            type: integer
          amount:
            type: number
            format: float
            nullable: true
            description: amount credited. Negative for a debit transaction, null for
              an incomplete transaction.
          financial_transaction_type_id:
            type: integer
            description: id of the type of the transaction
          note:
            type: string
            description: note entered with the transaction
          user_id:
            type: integer
            nullable: true
            description: id of user who entered the transaction (may be <tt>null</tt>
              for deleted users or 0 for a system user)
          user_name:
            type: string
            nullable: true
            description: name of user who entered the transaction (may be <tt>null</tt>
              or empty string for deleted users or system users)
          financial_transaction_type_name:
            type: string
            description: name of the type of the transaction
          created_at:
            type: string
            format: date-time
            description: when the transaction was entered
        required:
        - id
        - user_id
        - user_name
        - financial_transaction_type_name
        - created_at
    FinancialTransactionForCreate:
      type: object
      properties:
        amount:
          type: number
          format: float
          description: amount credited (negative for a debit transaction)
        financial_transaction_type_id:
          type: integer
          description: id of the type of the transaction
        note:
          type: string
          description: note entered with the transaction
      required:
      - amount
      - note
      - user_id
    FinancialTransactionClass:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
      required:
      - id
      - name
    FinancialTransactionType:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        name_short:
          type: string
          nullable: true
          description: short name (used for bank transfers)
        bank_account_id:
          type: integer
          nullable: true
          description: id of the bank account used for this transaction type
        bank_account_name:
          type: string
          nullable: true
          description: name of the bank account used for this transaction type
        bank_account_iban:
          type: string
          nullable: true
          description: IBAN of the bank account used for this transaction type
        financial_transaction_class_id:
          type: integer
          description: id of the class of the transaction
        financial_transaction_class_name:
          type: string
          description: name of the class of the transaction
      required:
      - id
      - name
      - financial_transaction_class_id
      - financial_transaction_class_name
    GroupOrderArticleForUpdate:
      type: object
      properties:
        quantity:
          type: integer
          description: number of units ordered by the users ordergroup
        tolerance:
          type: integer
          description: number of extra units the users ordergroup is willing to buy
            for filling a box
    GroupOrderArticleForCreate:
      allOf:
      - "$ref": "#/components/schemas/GroupOrderArticleForUpdate"
      - type: object
        properties:
          order_article_id:
            type: integer
            description: id of order article
    GroupOrderArticle:
      allOf:
      - "$ref": "#/components/schemas/GroupOrderArticleForCreate"
      - type: object
        properties:
          id:
            type: integer
          result:
            type: number
            format: float
            description: number of units the users ordergroup will receive or has
              received
          total_price:
            type: number
            format: float
            description: total price of this group order article
          order_article_id:
            type: integer
            description: id of order article
        required:
        - order_article_id
    q_ordered:
      type: object
      properties:
        ordered:
          type: string
          enum:
          - member
          - all
          - supplier
    Meta:
      type: object
      properties:
        page:
          type: integer
          description: page number of the returned collection
        per_page:
          type: integer
          description: number of items per page
        total_pages:
          type: integer
          description: total number of pages
        total_count:
          type: integer
          description: total number of items in the collection
      required:
      - page
      - per_page
      - total_pages
      - total_count
    Navigation:
      type: array
      items:
        type: object
        properties:
          name:
            type: string
            description: title
          url:
            type: string
            description: link
          items:
            "$ref": "#/components/schemas/Navigation"
        required:
        - name
        minProperties: 2
    Error:
      type: object
      properties:
        error:
          type: string
          description: error code
        error_description:
          type: string
          description: human-readable error message (localized)
    Error401:
      type: object
      properties:
        error:
          type: string
          description: "<tt>unauthorized</tt>"
        error_description:
          "$ref": "#/components/schemas/Error/properties/error_description"
    Error403:
      type: object
      properties:
        error:
          type: string
          description: "<tt>forbidden</tt> or <tt>invalid_scope</tt>"
        error_description:
          "$ref": "#/components/schemas/Error/properties/error_description"
    Error404:
      type: object
      properties:
        error:
          type: string
          description: "<tt>not_found</tt>"
        error_description:
          "$ref": "#/components/schemas/Error/properties/error_description"
    Error422:
      type: object
      properties:
        error:
          type: string
          description: "<tt>unprocessable entity</tt>"
        error_description:
          "$ref": "#/components/schemas/Error/properties/error_description"
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        implicit:
          authorizationUrl: http://localhost:3000/f/oauth/authorize
          scopes:
            config:user: reading Foodsoft configuration for regular users
            config:read: reading Foodsoft configuration values
            config:write: reading and updating Foodsoft configuration values
            finance:user: accessing your own financial transactions
            finance:read: reading all financial transactions
            finance:write: reading and creating financial transactions
            user:read: reading your own user profile
            user:write: reading and updating your own user profile
            offline_access: retain access after user has logged out
servers:
- url: http://{defaultHost}/f/api/v1
  variables:
    defaultHost:
      default: localhost:3000
security:
- oauth2:
  - user:read
