openapi: 3.0.0
info:
  title: BDL217 Api
  description: BDL217 API documentation
  contact:
    name: BDL217
    email: daniel@sum.consulting
  version: 1.0.0
servers:
  - url: https://bdl217-sandbox-api.collegedesproducteurs.be/
    description: Sandbox server (latest version)
  - url: https://bdl217-sandbox-api.collegedesproducteurs.be/v1
    description: Sandbox server V1 version (stable)
  - url: https://bdl217-api.collegedesproducteurs.be/
    description: Production server
  - url: https://bdl217-staging-api.collegedesproducteurs.be/
    description: Staging server
paths:
  /api/vat/check:
    get:
      tags:
        - Utils
      summary: Check VAT number
      operationId: getVatCheck
      parameters:
        - name: vat
          in: query
          description: VAT number to check
          required: true
          schema:
            type: string
      responses:
        "409":
          description: Vat Already exists
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: object
                    properties:
                      vat:
                        type: string
                        description: "The VAT number"
                  team:
                    type: object
                    properties:
                      id:
                        type: integer
                        format: int64
                        description: The ID of the team
                      name:
                        type: string
                        description: The name of the team
        "200":
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  isValid:
                    type: boolean
                  requestDate:
                    type: string
                    format: date-time
                  userError:
                    type: string
                  name:
                    type: string
                  address:
                    type: string
                  requestIdentifier:
                    type: string
                  originalVatNumber:
                    type: string
                  vatNumber:
                    type: string
                  viesApproximate:
                    type: object
                    properties:
                      name:
                        type: string
                      street:
                        type: string
                      postalCode:
                        type: string
                      city:
                        type: string
                      companyType:
                        type: string
                      matchName:
                        type: integer
                      matchStreet:
                        type: integer
                      matchPostalCode:
                        type: integer
                      matchCity:
                        type: integer
                      matchCompanyType:
                        type: integer
                  vat:
                    type: string
  /api/auth/register:
    post:
      tags:
        - Auth
      summary: Register a new user
      security:
        - BearerAuth: [ ]
      operationId: postAuthRegister
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AuthRegisterRequest"
      responses:
        "200":
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AuthUser"
  /api/auth/login:
    post:
      tags:
        - Auth
      summary: User login
      security:
        - BearerAuth: [ ]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - email
                - password
              properties:
                email:
                  type: string
                  format: email
                  description: User's email address
                password:
                  type: string
                  format: password
                  description: User's password
      operationId: postAuthLogin
      responses:
        "200":
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AuthUser"
  /api/auth/logout:
    post:
      tags:
        - Auth
      summary: User logout
      security:
        - BearerAuth: [ ]
      operationId: postAuthLogout
      responses:
        "200":
          description: Successful operation
  /api/auth/me:
    get:
      tags:
        - Auth
      summary: Get authenticated user details
      security:
        - BearerAuth: [ ]
      operationId: getAuthMe
      responses:
        "200":
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AuthUser"
  /api/auth/user:
    put:
      tags:
        - Auth
      summary: Update user details
      security:
        - BearerAuth: [ ]
      operationId: putAuthUser
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - email
                - name
              properties:
                email:
                  type: string
                  format: email
                  description: User's email address
                name:
                  type: string
                  description: User's full name
                phone:
                  type: string
                  description: User's phone number
                national_id_number:
                  type: string
                  description: User's national id number
                national_id_number_type:
                  type: string
                  description: User's national id number type
                profile_photo_path:
                  type: string
                  description: User's profile photo path
                toc_at:
                  type: string
                  description: User's terms of conditions acceptance date
      responses:
        "200":
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AuthUser"
    delete:
      tags:
        - Auth
      summary: Delete user account
      operationId: deleteUserAccount
      responses:
        "200":
          description: Successful operation
  /api/auth/update-password:
    put:
      tags:
        - Auth
      summary: Update user password
      security:
        - BearerAuth: [ ]
      operationId: putAuthUpdatePassword
      responses:
        "200":
          description: Successful operation
  /api/auth/update-profile-photo:
    put:
      tags:
        - Auth
      summary: Update user profile photo
      security:
        - BearerAuth: [ ]
      operationId: putAuthUpdateProfilePhoto
      responses:
        "200":
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AuthUser"
  /api/auth/forgot-password:
    put:
      tags:
        - Auth
      summary: Request password reset
      security:
        - BearerAuth: [ ]
      operationId: putAuthForgotPassword
      responses:
        "200":
          description: Successful operation
  /api/auth/reset-password:
    put:
      tags:
        - Auth
      summary: Reset user password
      security:
        - BearerAuth: [ ]
      operationId: putAuthResetPassword
      responses:
        "200":
          description: Successful operation
  /api/categories:
    get:
      tags:
        - Category
      summary: Get a list of categories
      security:
        - BearerAuth: [ ]
      operationId: getCategories
      parameters:
        - name: type
          in: query
          description: type of the category
          required: false
          explode: true
          schema:
            type: string
        - name: search
          in: query
          description: search for a category
          required: false
          explode: true
          schema:
            type: string
        - name: level
          in: query
          description: level of the category
          required: false
          explode: true
          schema:
            type: integer
        - $ref: "#/components/parameters/OrderByParameter"
        - $ref: "#/components/parameters/PaginationPerPageParameter"
        - $ref: "#/components/parameters/PaginationPageParameter"
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  current_page:
                    type: integer
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/Category"
                  first_page_url:
                    type: string
                  from:
                    type: integer
                  last_page:
                    type: integer
                  last_page_url:
                    type: string
                  links:
                    type: array
                    items:
                      type: object
                      properties:
                        url:
                          type: string
                        label:
                          type: string
                        active:
                          type: boolean
                  next_page_url:
                    type: string
                  path:
                    type: string
                  per_page:
                    type: integer
                  prev_page_url:
                    type: string
                  to:
                    type: integer
                  total:
                    type: integer
  /api/categories/tree:
    get:
      tags:
        - Category
      summary: Get a list of categories as a hierarchic tree
      security:
        - BearerAuth: [ ]
      operationId: getCategoriesTree
      parameters:
        - name: type
          in: query
          description: type of the category
          required: false
          explode: true
          schema:
            type: string
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: array
                items:
                  allOf:
                    - $ref: "#/components/schemas/Category"
                    - type: object
                      properties:
                        children:
                          type: array
                          items:
                            $ref: "#/components/schemas/Category"
  /api/gpc:
    get:
      tags:
        - Gpc
      summary: Get a list of GPC segment
      security:
        - BearerAuth: [ ]
      operationId: getGpc
      parameters:
        - name: lang
          in: query
          description: Lang of the GPC segment
          required: false
          schema:
            type: string
        - name: search
          in: query
          description: Search in the GPC list
          required: false
          schema:
            type: string
        - $ref: "#/components/parameters/OrderByParameter"
        - $ref: "#/components/parameters/PaginationPerPageParameter"
        - $ref: "#/components/parameters/PaginationPageParameter"
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/GPC"
  /api/gpc/segment:
    get:
      tags:
        - Gpc
      summary: Get a list of GPC segment
      security:
        - BearerAuth: [ ]
      operationId: getGpcSegment
      parameters:
        - name: lang
          in: query
          description: Lang of the GPC segment
          required: false
          schema:
            type: string
        - $ref: "#/components/parameters/OrderByParameter"
        - $ref: "#/components/parameters/PaginationPerPageParameter"
        - $ref: "#/components/parameters/PaginationPageParameter"
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  SegmentCode:
                    type: string
                  SegmentTitle:
                    type: string
                  SegmentDefinition:
                    type: string
  /api/gpc/family:
    get:
      tags:
        - Gpc
      summary: Get a list of GPC family
      security:
        - BearerAuth: [ ]
      operationId: getGpcFamily
      parameters:
        - name: lang
          in: query
          description: Lang of the GPC segment
          required: false
          schema:
            type: string
        - name: SegmentCode
          in: query
          description: SegmentCode of the GPC family
          required: false
          schema:
            type: string
        - $ref: "#/components/parameters/OrderByParameter"
        - $ref: "#/components/parameters/PaginationPerPageParameter"
        - $ref: "#/components/parameters/PaginationPageParameter"
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  SegmentCode:
                    type: string
                  SegmentTitle:
                    type: string
                  SegmentDefinition:
                    type: string
                  FamilyCode:
                    type: string
                  FamilyTitle:
                    type: string
                  FamilyDefinition:
                    type: string
  /api/gpc/class:
    get:
      tags:
        - Gpc
      summary: Get a list of GPC class
      security:
        - BearerAuth: [ ]
      operationId: getGpcClass
      parameters:
        - name: lang
          in: query
          description: Lang of the GPC class
          required: false
          schema:
            type: string
        - name: SegmentCode
          in: query
          description: SegmentCode of the GPC class
          required: false
          schema:
            type: string
        - name: FamilyCode
          in: query
          description: FamilyCode of the GPC class
          required: false
          schema:
            type: string
        - $ref: "#/components/parameters/OrderByParameter"
        - $ref: "#/components/parameters/PaginationPerPageParameter"
        - $ref: "#/components/parameters/PaginationPageParameter"
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  SegmentCode:
                    type: string
                  SegmentTitle:
                    type: string
                  SegmentDefinition:
                    type: string
                  FamilyCode:
                    type: string
                  FamilyTitle:
                    type: string
                  FamilyDefinition:
                    type: string
                  ClassCode:
                    type: string
                  ClassTitle:
                    type: string
                  ClassDefinition:
                    type: string
  /api/gpc/brick:
    get:
      tags:
        - Gpc
      summary: Get a list of GPC brick
      security:
        - BearerAuth: [ ]
      operationId: getGpcBrick
      parameters:
        - name: lang
          in: query
          description: Lang of the GPC brick
          required: false
          schema:
            type: string
        - name: SegmentCode
          in: query
          description: SegmentCode of the GPC brick
          required: false
          schema:
            type: string
        - name: FamilyCode
          in: query
          description: FamilyCode of the GPC brick
          required: false
          schema:
            type: string
        - name: ClassCode
          in: query
          description: ClassCode of the GPC brick
          required: false
          schema:
            type: string
        - $ref: "#/components/parameters/OrderByParameter"
        - $ref: "#/components/parameters/PaginationPerPageParameter"
        - $ref: "#/components/parameters/PaginationPageParameter"
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  SegmentCode:
                    type: string
                  SegmentTitle:
                    type: string
                  SegmentDefinition:
                    type: string
                  FamilyCode:
                    type: string
                  FamilyTitle:
                    type: string
                  FamilyDefinition:
                    type: string
                  ClassCode:
                    type: string
                  ClassTitle:
                    type: string
                  ClassDefinition:
                    type: string
                  BrickCode:
                    type: string
                  BrickTitle:
                    type: string
                  BrickDefinition_Includes:
                    type: string
                  BrickDefinition_Excludes:
                    type: string
  /api/gpc/attribute:
    get:
      tags:
        - Gpc
      summary: Get a list of GPC attribute
      security:
        - BearerAuth: [ ]
      operationId: getGpcAttribute
      parameters:
        - name: lang
          in: query
          description: Lang of the GPC attribute
          required: false
          schema:
            type: string
        - name: SegmentCode
          in: query
          description: SegmentCode of the GPC attribute
          required: false
          schema:
            type: string
        - name: FamilyCode
          in: query
          description: FamilyCode of the GPC attribute
          required: false
          schema:
            type: string
        - name: ClassCode
          in: query
          description: ClassCode of the GPC attribute
          required: false
          schema:
            type: string
        - name: BrickCode
          in: query
          description: BrickCode of the GPC attribute
          required: false
          schema:
            type: string
        - $ref: "#/components/parameters/OrderByParameter"
        - $ref: "#/components/parameters/PaginationPerPageParameter"
        - $ref: "#/components/parameters/PaginationPageParameter"
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  SegmentCode:
                    type: string
                  SegmentTitle:
                    type: string
                  SegmentDefinition:
                    type: string
                  FamilyCode:
                    type: string
                  FamilyTitle:
                    type: string
                  FamilyDefinition:
                    type: string
                  ClassCode:
                    type: string
                  ClassTitle:
                    type: string
                  ClassDefinition:
                    type: string
                  BrickCode:
                    type: string
                  BrickTitle:
                    type: string
                  BrickDefinition_Includes:
                    type: string
                  BrickDefinition_Excludes:
                    type: string
                  AttributeCode:
                    type: string
                  AttributeTitle:
                    type: string
                  AttributeDefinition:
                    type: string
  /api/gpc/attribute-value:
    get:
      tags:
        - Gpc
      summary: Get a list of GPC attribute value
      security:
        - BearerAuth: [ ]
      operationId: getGpcAttributeValue
      parameters:
        - name: lang
          in: query
          description: Lang of the GPC attribute value
          required: false
          schema:
            type: string
        - name: SegmentCode
          in: query
          description: SegmentCode of the GPC attribute value
          required: false
          schema:
            type: string
        - name: FamilyCode
          in: query
          description: FamilyCode of the GPC attribute value
          required: false
          schema:
            type: string
        - name: ClassCode
          in: query
          description: ClassCode of the GPC attribute value
          required: false
          schema:
            type: string
        - name: BrickCode
          in: query
          description: BrickCode of the GPC attribute value
          required: false
          schema:
            type: string
        - name: AttributeCode
          in: query
          description: AttributeCode of the GPC attribute value
          required: false
          schema:
            type: string
        - $ref: "#/components/parameters/OrderByParameter"
        - $ref: "#/components/parameters/PaginationPerPageParameter"
        - $ref: "#/components/parameters/PaginationPageParameter"
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  SegmentCode:
                    type: string
                  SegmentTitle:
                    type: string
                  SegmentDefinition:
                    type: string
                  FamilyCode:
                    type: string
                  FamilyTitle:
                    type: string
                  FamilyDefinition:
                    type: string
                  ClassCode:
                    type: string
                  ClassTitle:
                    type: string
                  ClassDefinition:
                    type: string
                  BrickCode:
                    type: string
                  BrickTitle:
                    type: string
                  BrickDefinition_Includes:
                    type: string
                  BrickDefinition_Excludes:
                    type: string
                  AttributeCode:
                    type: string
                  AttributeTitle:
                    type: string
                  AttributeDefinition:
                    type: string
                  AttributeValueCode:
                    type: string
                  AttributeValueTitle:
                    type: string
                  AttributeValueDefinition:
                    type: string
  /api/categories/{id}:
    get:
      tags:
        - Category
      summary: Get a Category by ID
      security:
        - BearerAuth: [ ]
      operationId: getCategoryById
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
        - $ref: "#/components/parameters/OrderByParameter"
        - $ref: "#/components/parameters/PaginationPerPageParameter"
        - $ref: "#/components/parameters/PaginationPageParameter"
      responses:
        "200":
          description: A Category object
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Category"
  /api/stats:
    get:
      tags:
        - Stats
      summary: Get global stats of BDL217
      security:
        - BearerAuth: [ ]
      operationId: getStats
      responses:
        "200":
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  total_users:
                    description: Total number of users registered in BDL217
                    type: integer
                  total_products:
                    description: Total products in BDL217
                    type: integer
                  total_providers:
                    description: Total providers in BDL217
                    type: integer
                  total_teams:
                    description: Total teams (organizations) in BDL217
                    type: integer
                  total_users_before:
                    type: integer
                  total_products_before:
                    type: integer
                  total_providers_before:
                    type: integer
                  total_teams_before:
                    type: integer
  #    put:
  #      tags:
  #        - Category
  #      summary: Update a Category
  #      parameters:
  #        - name: id
  #          in: path
  #          required: true
  #          schema:
  #            type: integer
  #      requestBody:
  #        required: true
  #        content:
  #          application/json:
  #            schema:
  #              $ref: "#/components/schemas/Category"
  #      responses:
  #        "200":
  #          description: Category updated
  #          content:
  #            application/json:
  #              schema:
  #                $ref: "#/components/schemas/Category"
  #    delete:
  #      tags:
  #        - Category
  #      summary: Delete a Category
  #      parameters:
  #        - name: id
  #          in: path
  #          required: true
  #          schema:
  #            type: integer
  #      responses:
  #        "204":
  #          description: Category deleted
  /api/tags:
    get:
      tags:
        - Tag
      summary: Get a list of tags
      security:
        - BearerAuth: [ ]
      operationId: getTags
      parameters:
        - name: type
          in: query
          description: type of the tag
          required: false
          explode: true
          schema:
            type: string
        - $ref: "#/components/parameters/OrderByParameter"
        - $ref: "#/components/parameters/PaginationPerPageParameter"
        - $ref: "#/components/parameters/PaginationPageParameter"
      responses:
        "200":
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/Tag"
                  current_page:
                    type: integer
                  first_page_url:
                    type: string
                  from:
                    type: integer
                  last_page:
                    type: integer
                  last_page_url:
                    type: string
                  links:
                    type: array
                    items:
                      type: object
                      properties:
                        url:
                          type: string
                        label:
                          type: string
                        active:
                          type: boolean
                  next_page_url:
                    type: string
                  path:
                    type: string
                  per_page:
                    type: integer
                  prev_page_url:
                    type: string
                  to:
                    type: integer
                  total:
                    type: integer
  #    post:
  #      tags:
  #        - Tag
  #      summary: Create a new Tag
  #      requestBody:
  #        required: true
  #        content:
  #          application/json:
  #            schema:
  #              $ref: "#/components/schemas/Tag"
  #      responses:
  #        "201":
  #          description: Tag created
  #          content:
  #            application/json:
  #              schema:
  #                type: array
  #                items:
  #                  $ref: "#/components/schemas/Tag"
  /api/tags/{id}:
    get:
      tags:
        - Tag
      summary: Get a Tag by ID
      security:
        - BearerAuth: [ ]
      operationId: getTagById
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: A Tag object
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Tag"
  #    put:
  #      tags:
  #        - Tag
  #      summary: Update a Tag
  #      operationId: updateTag
  #      parameters:
  #        - name: id
  #          in: path
  #          required: true
  #          schema:
  #            type: integer
  #      requestBody:
  #        required: true
  #        content:
  #          application/json:
  #            schema:
  #              $ref: "#/components/schemas/Tag"
  #      responses:
  #        "200":
  #          description: Tag updated
  #          content:
  #            application/json:
  #              schema:
  #                type: array
  #                items:
  #                  $ref: "#/components/schemas/Tag"
  #    delete:
  #      tags:
  #        - Tag
  #      summary: Delete a Tag
  #      operationId: deleteTag
  #      parameters:
  #        - name: id
  #          in: path
  #          required: true
  #          schema:
  #            type: integer
  #      responses:
  #        "204":
  #          description: Tag deleted
  /api/products:
    get:
      tags:
        - Product
      summary: Get a list of products
      security:
        - BearerAuth: [ ]
      operationId: getProducts
      parameters:
        - $ref: "#/components/parameters/SearchQueryParameter"
        - $ref: "#/components/parameters/TeamIdQueryParameter"
        - $ref: "#/components/parameters/WhereParameter"
        - $ref: "#/components/parameters/OrderByParameter"
        - $ref: "#/components/parameters/SortParameter"
        - $ref: "#/components/parameters/PaginationPerPageParameter"
        - $ref: "#/components/parameters/PaginationPageParameter"
        - $ref: "#/components/parameters/MetaParameter"
      responses:
        "200":
          description: A JSON array of product objects
          content:
            application/json:
              schema:
                type: object
                properties:
                  current_page:
                    type: integer
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/Product"
                  first_page_url:
                    type: string
                  from:
                    type: integer
                  last_page:
                    type: integer
                  last_page_url:
                    type: string
                  links:
                    type: array
                    items:
                      type: object
                      properties:
                        url:
                          type: string
                        label:
                          type: string
                        active:
                          type: boolean
                  next_page_url:
                    type: string
                  path:
                    type: string
                  per_page:
                    type: integer
                  prev_page_url:
                    type: string
                  to:
                    type: integer
                  total:
                    type: integer
    post:
      tags:
        - Product
      summary: Create a new product
      operationId: createProduct
      security:
        - BearerAuth: [ ]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ProductPostRequest"
      responses:
        "201":
          description: Product created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Product"
  /api/products/update:
    get:
      tags:
        - Product
      summary: Get a list of updated products
      parameters:
        - $ref: "#/components/parameters/WhereParameter"
        - $ref: "#/components/parameters/OrderByParameter"
        - $ref: "#/components/parameters/PaginationPerPageParameter"
        - $ref: "#/components/parameters/PaginationPageParameter"
      security:
        - BearerAuth: [ ]
      operationId: getProductsUpdate
      responses:
        "200":
          description: A JSON array of product objects
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string
  /api/products/{id}:
    get:
      tags:
        - Product
      summary: Get a product by ID
      security:
        - BearerAuth: [ ]
      operationId: getProductById
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        "200":
          description: A product object
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Product"
    put:
      tags:
        - Product
      summary: Update a product
      operationId: updateProduct
      security:
        - BearerAuth: [ ]
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ProductUpdateRequest"
      responses:
        "200":
          description: Product updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Product"
        "422":
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    delete:
      tags:
        - Product
      summary: Delete a product
      operationId: deleteProduct
      security:
        - BearerAuth: [ ]
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        "204":
          description: Product deleted
  /api/products/{id}/clone:
    post:
      tags:
        - Product
      summary: Clone a product
      operationId: cloneProduct
      security:
        - BearerAuth: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        "200":
          description: A product object
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Product"
  #  /api/users:
  #    get:
  #      tags:
  #        - User
  #      summary: Get a list of users
  #      operationId: getUsers
  #      responses:
  #        "200":
  #          description: A JSON array of user objects
  #          content:
  #            application/json:
  #              schema:
  #                type: object
  #                properties:
  #                  current_page:
  #                    type: integer
  #                  data:
  #                    type: array
  #                    items:
  #                      $ref: "#/components/schemas/User"
  #                  first_page_url:
  #                    type: string
  #                  from:
  #                    type: integer
  #                  last_page:
  #                    type: integer
  #                  last_page_url:
  #                    type: string
  #                  links:
  #                    type: array
  #                    items:
  #                      type: object
  #                      properties:
  #                        url:
  #                          type: string
  #                        label:
  #                          type: string
  #                        active:
  #                          type: boolean
  #                  next_page_url:
  #                    type: string
  #                  path:
  #                    type: string
  #                  per_page:
  #                    type: integer
  #                  prev_page_url:
  #                    type: string
  #                  to:
  #                    type: integer
  #                  total:
  #                    type: integer
  #    post:
  #      tags:
  #        - User
  #      summary: Create a new user
  #      requestBody:
  #        required: true
  #        content:
  #          application/json:
  #            schema:
  #              $ref: "#/components/schemas/User"
  #      responses:
  #        "201":
  #          description: User created
  #          content:
  #            application/json:
  #              schema:
  #                type: array
  #                items:
  #                  $ref: "#/components/schemas/User"
  #  /api/users/{userId}:
  #    get:
  #      tags:
  #        - User
  #      summary: Get a user by ID
  #      operationId: getUserById
  #      parameters:
  #        - name: userId
  #          in: path
  #          required: true
  #          schema:
  #            type: integer
  #      responses:
  #        "200":
  #          description: A user object
  #          content:
  #            application/json:
  #              schema:
  #                $ref: "#/components/schemas/User"
  #    put:
  #      tags:
  #        - User
  #      summary: Update a user
  #      operationId: updateUser
  #      parameters:
  #        - name: userId
  #          in: path
  #          required: true
  #          schema:
  #            type: integer
  #      requestBody:
  #        required: true
  #        content:
  #          application/json:
  #            schema:
  #              $ref: "#/components/schemas/User"
  #      responses:
  #        "200":
  #          description: User updated
  #          content:
  #            application/json:
  #              schema:
  #                $ref: "#/components/schemas/User"
  #        "422":
  #          description: Unprocessable Entity
  #          content:
  #            application/json:
  #              schema:
  #                $ref: "#/components/schemas/Error"
  #        default:
  #          description: Unexpected error
  #          content:
  #            application/json:
  #              schema:
  #                $ref: '#/components/schemas/Error'
  #    delete:
  #      tags:
  #        - User
  #      summary: Delete a user
  #      operationId: deleteUser
  #      parameters:
  #        - name: userId
  #          in: path
  #          required: true
  #          schema:
  #            type: integer
  #      responses:
  #        "204":
  #          description: User deleted
  /api/teams:
    get:
      tags:
        - Team
      summary: Get a list of teams
      security:
        - BearerAuth: [ ]
      operationId: getTeams
      parameters:
        - $ref: "#/components/parameters/WhereParameter"
        - $ref: "#/components/parameters/OrderByParameter"
        - $ref: "#/components/parameters/PaginationPerPageParameter"
        - $ref: "#/components/parameters/PaginationPageParameter"
      responses:
        "200":
          description: A JSON array of user objects
          content:
            application/json:
              schema:
                type: object
                properties:
                  current_page:
                    type: integer
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/Team"
                  first_page_url:
                    type: string
                  from:
                    type: integer
                  last_page:
                    type: integer
                  last_page_url:
                    type: string
                  links:
                    type: array
                    items:
                      type: object
                      properties:
                        url:
                          type: string
                        label:
                          type: string
                        active:
                          type: boolean
                  next_page_url:
                    type: string
                  path:
                    type: string
                  per_page:
                    type: integer
                  prev_page_url:
                    type: string
                  to:
                    type: integer
                  total:
                    type: integer
    post:
      tags:
        - Team
      summary: Create a new team
      security:
        - BearerAuth: [ ]
      operationId: createTeam
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/TeamPostRequest"
      responses:
        "201":
          description: Team created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Team"
  /api/teams/{id}:
    get:
      tags:
        - Team
      summary: Get a team by ID
      security:
        - BearerAuth: [ ]
      operationId: getTeamById
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: A team object
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Team"
    put:
      tags:
        - Team
      summary: Update a team
      operationId: updateTeam
      security:
        - BearerAuth: [ ]
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/TeamPutRequest"
      responses:
        "200":
          description: Team updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Team"
        "422":
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    delete:
      tags:
        - Team
      summary: Delete a team
      security:
        - BearerAuth: [ ]
      operationId: deleteTeam
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: Team deleted
  /api/teams/{team_id}/members:
    parameters:
      - name: team_id
        in: path
        required: true
        schema:
          type: integer
      - $ref: "#/components/parameters/OrderByParameter"
      - $ref: "#/components/parameters/PaginationPerPageParameter"
      - $ref: "#/components/parameters/PaginationPageParameter"
    get:
      tags:
        - TeamMember
      summary: Get a list of members
      security:
        - BearerAuth: [ ]
      operationId: getTeamMembers
      responses:
        "200":
          description: A JSON array of user objects
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/TeamMember"

    post:
      tags:
        - TeamMember
      summary: Create a new team member
      security:
        - BearerAuth: [ ]
      operationId: createTeamMember
      requestBody:
        required: true
        content:
          application/json:
            schema:
              properties:
                team_id:
                  type: integer
                user_id:
                  type: integer
                role:
                  type: string
      responses:
        "201":
          description: Team created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Team"
        "422":
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        default:
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /api/team/{team_id}/members/{id}:
    parameters:
      - name: team_id
        in: path
        required: true
        schema:
          type: integer
      - name: id
        in: path
        required: true
        schema:
          type: integer
    get:
      tags:
        - TeamMember
      summary: Get a team by ID
      security:
        - BearerAuth: [ ]
      operationId: getTeamMemberById
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: A team object
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/User"
    put:
      tags:
        - TeamMember
      summary: Update a team
      security:
        - BearerAuth: [ ]
      operationId: updateTeamMember
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/User"
      responses:
        "200":
          description: Team updated
    delete:
      tags:
        - TeamMember
      summary: Delete a team
      security:
        - BearerAuth: [ ]
      operationId: deleteTeamMember
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: Team deleted
  /api/teams/{team_id}/upload:
    parameters:
      - name: team_id
        in: path
        required: true
        schema:
          type: integer
    post:
      tags:
        - Team
      summary: Upload a file
      security:
        - BearerAuth: [ ]
      operationId: postTeamUpload
      description: Endpoint to upload a file.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
      responses:
        "200":
          description: File uploaded successfully
        "400":
          description: Bad request
  /api/teams/{team_id}/upload/{id}:
    parameters:
      - name: team_id
        in: path
        required: true
        schema:
          type: integer
      - name: id
        in: path
        required: true
        schema:
          type: integer
    delete:
      tags:
        - Team
      summary: Delete a file
      security:
        - BearerAuth: [ ]
      operationId: deleteTeamUpload
      description: Endpoint to delete a file.
      responses:
        "200":
          description: File deleted successfully
        "400":
          description: Bad request
  /api/products/{id}/upload:
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
    post:
      tags:
        - Product
      summary: Upload a file
      security:
        - BearerAuth: [ ]
      operationId: postProductUpload
      description: Endpoint to upload a file.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
      responses:
        "200":
          description: File uploaded successfully
        "400":
          description: Bad request
  /api/products/{id}/upload/{mediaId}:
    parameters:
      - name: mediaId
        in: path
        required: true
        schema:
          type: integer
      - name: id
        in: path
        required: true
        schema:
          type: string
    delete:
      tags:
        - Product
      summary: Upload a file
      security:
        - BearerAuth: [ ]
      operationId: deleteProductUpload
      description: Endpoint to delete a file.
      responses:
        "200":
          description: File deleted successfully
        "400":
          description: Bad request
  /api/users/{id}/upload:
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
    post:
      tags:
        - User
      summary: Upload a file
      security:
        - BearerAuth: [ ]
      operationId: postUserUpload
      description: Endpoint to upload a file.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
      responses:
        "200":
          description: File uploaded successfully
        "400":
          description: Bad request
  /api/users/{id}/upload/{mediaId}:
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: integer
      - name: mediaId
        in: path
        required: true
        schema:
          type: integer
    delete:
      tags:
        - User
      summary: Upload a file
      security:
        - BearerAuth: [ ]
      operationId: deleteProductUploadById
      description: Endpoint to delete a file.
      responses:
        "200":
          description: File deleted successfully
        "400":
          description: Bad request
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
  parameters:
    SearchQueryParameter:
      name: search
      in: query
      description: search for a category
      required: false
      schema:
        type: string
    MetaParameter:
      name: meta
      in: query
      description: define if you want only the meta catalog of products
      required: false
      schema:
        type: boolean
    TeamIdQueryParameter:
      name: team_id
      in: query
      description: team id
      required: false
      schema:
        type: integer
    WhereParameter:
      name: where
      in: query
      description: where clause
      required: false
      explode: true
      schema:
        type: array
        items:
          $ref: "#/components/schemas/WhereQuery"
    OrderByParameter:
      name: order_by
      in: query
      description: order by clause
      required: false
      schema:
        type: object
        properties:
          column:
            type: string
          direction:
            type: string
    SortParameter:
      name: sort
      in: query
      description: sort by clause (e.g. column-direction, name-asc, name-desc)
      required: false
      schema:
        type: string
    PaginationPerPageParameter:
      name: per_page
      in: query
      description: number of items per page
      required: false
      schema:
        type: integer
    PaginationPageParameter:
      name: page
      in: query
      description: page number that you want (see meta for pagination infos)
      required: false
      schema:
        type: integer
  schemas:
    Category:
      description: Categories are used to group things with a hierarchy
      type: object
      required:
        - name
        - type
      properties:
        id:
          type: integer
          format: int64
        name:
          allOf:
            - $ref: "#/components/schemas/Translatable"
            - description: Name of the category
        code:
          type: string
          description: Code of the category
        level:
          type: integer
          description: Level of the category
        description:
          allOf:
            - $ref: "#/components/schemas/Translatable"
            - description: Description of the category (max 255 characters)
        active:
          type: boolean
          description: Active status of the category (true or false)
        slug:
          allOf:
            - $ref: "#/components/schemas/Translatable"
            - description: Slug of the category (unique identifier for SEO)
        type:
          type: string
          description: Type of the category (e.g. product, service, etc..)
        _lft:
          description: "Left value of the category (used to order category using the nested set model : https://en.wikipedia.org/wiki/Nested_set_model)"
          type: integer
        _rgt:
          description: "Right value of the category (used to order category using the nested set model : https://en.wikipedia.org/wiki/Nested_set_model)"
          type: integer
        parent_id:
          description: Parent category id
          type: integer
        created_at:
          description: Date of creation of the category
          type: string
        updated_at:
          description: Date of last update of the category
          type: string
    User:
      description: User object that are part of a team or multiple teams
      type: object
      required:
        - id
        - name
        - email
        - created_at
        - teams
      properties:
        id:
          type: integer
          format: int64
          description: Unique identifier of the user
        name:
          type: string
          description: Name of the user (e.g. John Doe)
        language:
          type: string
          description: Language of the user in ISO 639-1 format (e.g. en, fr, es, etc..)
        first_name:
          type: string
          description: First name of the user
        last_name:
          type: string
          description: Last name of the user
        email:
          type: string
          format: email
          description: Email of the user
        current_team:
          allOf:
            - description: Current team of the user
            - $ref: "#/components/schemas/Team"
        teams:
          description: Teams of the user
          type: array
          items:
            $ref: "#/components/schemas/Team"
        current_team_id:
          description: Current team id of the user
          type: integer
        created_at:
          description: Date of creation of the user
          type: string
        updated_at:
          description: Date of last update of the user
          type: string
    AuthRegisterRequest:
      description: Register form request when creating a new user and team
      type: object
      required:
        - first_name
        - last_name
        - email
        - team_name
        - team_vat
        - team_type
        - password
        - password_confirmation
      properties:
        first_name:
          type: string
          description: First name of the user
        last_name:
          type: string
          description: Last name of the user
        email:
          type: string
          format: email
          description: Email of the user
        team_name:
          type: string
          description: Name of the team
        team_vat:
          type: string
          description: VAT number of the team
        team_type:
          type: integer
          description: "Type of the team (ID of the category list : /api/categories?type=team_type&per_page=100)"
        password:
          type: string
          format: password
          description: Password of the user
        password_confirmation:
          type: string
          format: password
          description: Password confirmation of the user
        team_address:
          type: string
          description: "Formatted address of the team (format : number, street, city, postal_code, country)"
        team_lat:
          type: string
          description: Latitude of the team (not mandatory but highly recommended)
        team_lng:
          type: string
          description: Longitude of the team (not mandatory but highly recommended)
    Tag:
      description: Tags are used to group things without hierarchy
      type: object
      required:
        - name
        - type
      properties:
        id:
          description: Unique identifier of the tag
          type: integer
          format: int64
        name:
          allOf:
            - description: Name of the tag
            - $ref: "#/components/schemas/Translatable"
        icon:
          allOf:
            - $ref: "#/components/schemas/Translatable"
            - description: Icon of the tag (full URL to image file)
        slug:
          allOf:
            - description: "Short human readable identifier (no accentuation + whitespaces replaced by hyphens)"
            - $ref: "#/components/schemas/Translatable"
        ref_id:
          description: Reference id of the tag (used by the provider that created the tag). null if it's created internally
          type: string
        ref_type:
          description: Reference type of the tag (used by the provider that created the tag). null if it's created internally
          type: string
        type:
          description: Type of the tag (e.g. labels, uom, Allergen, etc..)
          type: string
        order_column:
          description: Order by sequence within the tag type
          type: string
        active:
          description: Active status of the tag (true or false)
          type: boolean
        created_at:
          description: Date of creation of the tag
          type: string
        updated_at:
          description: Date of last update of the tag
          type: string
    TeamPostRequest:
      description: TeamPostRequest
      type: object
      required:
        - name
        - vat
      properties:
        name:
          description: Name of the team
          type: string
        vat:
          description: VAT number of the team
          type: string
        user_id:
          description: "User id of the main admin of the team (if null you will be the admin)"
          type: integer
        categories:
          description: "Categories of the team see /api/categories?type=team_type&per_page=100"
          type: array
          items:
            type: integer
        addresses:
          description: The addresses list of the team
          type: array
          items:
            $ref: "#/components/schemas/Address"
        contacts:
          description: The contacts list of the team
          type: array
          items:
            $ref: "#/components/schemas/Contact"
        active:
          description: Define if the team is active or not
          type: boolean
        created_at:
          description: Date of creation of the team
          type: string
        updated_at:
          description: Date of last update of the team
          type: string
        gln_status:
          description: Current status of the GLN registration request in GS1
          readOnly: true
          type: string
          enum:
            - active
            - inactive
            - pending
            - refused
        images:
          type: array
          description: The images list of the team (logo, etc..)
          items:
            $ref: "#/components/schemas/Image"
        gln:
          description: GS1's producer ID, if known
          readOnly: true
          type: string
        company_number:
          description: The company number of the team (might differ from VAT in some country)
          type: string
        vat_exemption:
          description: Define if the team is VAT exempted
          type: boolean
        farmer_sectors:
          description: Farming sectors (if applicable) See /api/categories?type=farmer_sector&per_page=100
          type: array
          items:
            $ref: "#/components/schemas/Category"
        main_language:
          description: The main language of the team
          type: string
        other_languages:
          description: The other languages of the team (iso
          type: array
          items:
            type: object
            properties:
              id:
                type: string
              label:
                type: string
        name_friendly:
          description: Name towards customers. Official one used if this one is empty
          type: string
        website:
          description: The website of the Organization
          type: string
        short_bio:
          allOf:
            - description: Short bio of the team
            - $ref: "#/components/schemas/Translatable"
        long_bio:
          allOf:
            - description: Long bio of the team
            - $ref: "#/components/schemas/Translatable"
        visibility:
          nullable: true
          description: Define what can of categories team_type can see the team
          type: object
          properties:
            info:
              allOf:
                - description: Define who can't see the team
                - $ref: "#/components/schemas/Visibility"
            products:
              allOf:
                - description: Define who can't see the products of the team
                - $ref: "#/components/schemas/Visibility"
            commercial:
              allOf:
                - description: Define who can't see the commercial infos of the team
                - $ref: "#/components/schemas/Visibility"
    TeamPutRequest:
      description: TeamPutRequest
      type: object
      properties:
        name:
          description: Name of the team
          type: string
        vat:
          description: VAT number of the team
          type: string
        user_id:
          description: "User id of the main admin of the team (if null you will be the admin)"
          type: integer
        categories:
          description: "Categories of the team see /api/categories?type=team_type&per_page=100"
          type: array
          items:
            type: integer
        addresses:
          description: The addresses list of the team
          type: array
          items:
            $ref: "#/components/schemas/Address"
        contacts:
          description: The contacts list of the team
          type: array
          items:
            $ref: "#/components/schemas/Contact"
        active:
          description: Define if the team is active or not
          type: boolean
        created_at:
          description: Date of creation of the team
          type: string
        updated_at:
          description: Date of last update of the team
          type: string
        gln_status:
          description: Current status of the GLN registration request in GS1
          readOnly: true
          type: string
          enum:
            - active
            - inactive
            - pending
            - refused
        images:
          type: array
          description: The images list of the team (logo, etc..)
          items:
            $ref: "#/components/schemas/Image"
        gln:
          description: GS1's producer ID, if known
          readOnly: true
          type: string
        company_number:
          description: The company number of the team (might differ from VAT in some country)
          type: string
        vat_exemption:
          description: Define if the team is VAT exempted
          type: boolean
        main_language:
          description: The main language of the team
          type: string
        farmer_sectors:
          description: Farming sectors (if applicable) See /api/categories?type=farmer_sector&per_page=100
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/Category"
        other_languages:
          description: The other languages of the team (iso
          type: array
          items:
            type: object
            properties:
              id:
                type: string
              label:
                type: string
        name_friendly:
          description: Name towards customers. Official one used if this one is empty
          type: string
        website:
          description: The website of the Organization
          type: string
        short_bio:
          allOf:
            - description: Short bio of the team
            - $ref: "#/components/schemas/Translatable"
        long_bio:
          allOf:
            - description: Long bio of the team
            - $ref: "#/components/schemas/Translatable"
        visibility:
          nullable: true
          description: Define what can of categories team_type can see the team
          type: object
          properties:
            info:
              allOf:
                - description: Define who can't see the team
                - $ref: "#/components/schemas/Visibility"
            products:
              allOf:
                - description: Define who can't see the products of the team
                - $ref: "#/components/schemas/Visibility"
            commercial:
              allOf:
                - description: Define who can't see the commercial infos of the team
                - $ref: "#/components/schemas/Visibility"
    Team:
      description: Team have members and are defined with their team_type categories, they might have products, team_members and prices. Team are an organization but can also be a single user organization.
      type: object
      required:
        - name
      properties:
        id:
          description: Unique identifier of the team
          type: integer
          format: int64
        addresses:
          description: The addresses list of the team
          type: array
          items:
            $ref: "#/components/schemas/Address"
        contacts:
          description: The contacts list of the team
          type: array
          items:
            $ref: "#/components/schemas/Contact"
        categories:
          description: Categories of Team (ref team_type)
          type: array
          items:
            $ref: "#/components/schemas/Category"
        user_id:
          description: "The user id of the creator of the team (team_type). See "
          type: string
        name:
          description: Official business name
          type: string
        active:
          description: Define if the team is active or not
          type: boolean
        created_at:
          description: Date of creation of the team
          type: string
        updated_at:
          description: Date of last update of the team
          type: string
        gln_status:
          description: Current status of the GLN registration request in GS1
          readOnly: true
          type: string
          enum:
            - active
            - inactive
            - pending
            - refused
        images:
          type: array
          description: The images list of the team (logo, etc..)
          items:
            $ref: "#/components/schemas/Image"
        gln:
          description: GS1's producer ID, if known
          readOnly: true
          type: string
        company_number:
          description: The company number of the team (might differ from VAT in some country)
          type: string
        vat:
          description: The VAT number of the team
          type: string
        vat_exemption:
          description: Define if the team is VAT exempted
          type: boolean
        main_language:
          description: The main language of the team
          type: string
        other_languages:
          description: The other languages of the team (iso
          type: array
          items:
            type: object
            properties:
              id:
                type: string
              label:
                type: string
        name_friendly:
          description: Name towards customers. Official one used if this one is empty
          type: string
        website:
          description: The website of the Organization
          type: string
        short_bio:
          allOf:
            - description: Short bio of the team
            - $ref: "#/components/schemas/Translatable"
        long_bio:
          allOf:
            - description: Long bio of the team
            - $ref: "#/components/schemas/Translatable"
        personal_team:
          description: Define if the team is a personal team (single user organization)
          type: boolean
        distance:
          description: Distance
          type: number
          nullable: true
        farmer_sectors:
          description: Farming sectors (if applicable) See /api/categories?type=farmer_sector&per_page=100
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/Category"
        role:
          description: Role of the user in the team. If null the user is not part of the team
          nullable: true
          type: string
          example: "admin|editor|viewer|null"
        total_members:
          description: Total members of the team
          nullable: true
          type: integer
        visibility:
          nullable: true
          description: Define what can of categories team_type can see the team
          type: object
          properties:
            info:
              type: object
              allOf:
                - description: Define who can see the info of the team
                - $ref: "#/components/schemas/Visibility"
            products:
              type: object
              allOf:
                - description: Define who can see the products info of the team
                - $ref: "#/components/schemas/Visibility"
            prices:
              type: object
              allOf:
                - description: Define who can see the prices info of the team
                - $ref: "#/components/schemas/Visibility"
    TeamMember:
      description: TeamMember object that are part of a team
      type: object
      properties:
        team_id:
          description: The team id of the team member
          type: integer
          format: int64
        user_id:
          description: The user id of the team member
          type: integer
          format: int64
        role:
          description: The role of the team member (admin or member)
          type: string
        updated_at:
          description: Date of last update of the team member
          type: string
        created_at:
          description: Date of creation of the team member
          type: string
    Product:
      description: Product object that are part of a team
      type: object
      required:
        - id
        - name
        - description
      properties:
        id:
          description: "Unique identifier of the product (in uuid format). Read Only (defined by the platform on creation). While updating through the API, content providers should ensure they'll not nullify or overwrite existing datas that are still relevant or that they cannot provide."
          type: string
          format: uuid
        active:
          description: "Define if the product is active or not. An inactive product can only be seen by the content managers for the product an dby the platform administrators, and is \"hidden\" for any other user. Product.active attribute via API (PUT POST) : back-end must force Product.active=false if team for this product is team.active=false"
          type: boolean
        name:
          allOf:
            - description: Name of the product (e.g. Lemon)
            - $ref: "#/components/schemas/Translatable"
        team_id:
          description: The team id of the product. Read Only (managed by the platform).
          readOnly: false
          type: integer
          format: int64
        creator_id:
          description: The creator id of the product. Read Only (managed by the platform).
          readOnly: false
          type: integer
          format: int64
        gtin:
          description: "Global Trade Item Number (GS1) if available. In write/update mode, The GUI will ensure that a contractual relationship exist with GS1's (availability and accuracy of the producers's GLN within BDPL217). API content providers must ensure this themself."
          type: string
        gtin_status:
          description: "Status of the GTIN. For a product with synced GTIN, we consider GS1 as the master data source for this product's description (which are \"read only\" for anyone else but the platform's admins)."
          type: string
        gtin_sync:
          description: "Sync status of the GTIN. For a product with synced GTIN, we consider GS1 as the master data source for this product's description (which are \"read only\" for anyone else but the platform's admins)."
          type: boolean
        brand:
          description: Brand of the product (if it's branded internally in an another name)
          type: string
        external_id:
          description: External id of the product (used for an external reference from the producer)
          type: string
        external_type:
          description: External type of the product (used for an external reference from the producer)
          type: string
        external_ids:
          description: A list of external ids related to the product (please merge existing values if you just want to update the list). Object of keyValueObject type that are not mandatory and not always standardized (please ensure that you manage correctly the type of the value). More infos on taxonomy here https://bdl217-docs.collegedesproducteurs.be/docs/intro#taxonomy-lists
          type: array
          items:
            type: object
            properties:
              id:
                description: Key of the external id (could be the ID, slug, uuid that you use as reference)
                type: string
              type:
                description: Type of the external id (see the list of supported external providers to create that)
                type: string
        description:
          allOf:
            - description: Description of the product
            - $ref: "#/components/schemas/Translatable"
        volumes_stocks_availabilities:
          allOf:
            - description: Volume stocks availabilities description of the product
            - $ref: "#/components/schemas/Translatable"
        price_policy:
          allOf:
            - $ref: "#/components/schemas/Translatable"
            - description: Price policy for the product
        category:
          description: "Category of the product (id). (A valid GS1 brick ID - see https://gpc-browser.gs1.org/)"
          type: string
        category_name:
          readOnly: true
          description: Category name of the product (read only)
          type: string
        tags:
          description: "Tags related to the product (see https://bdl217-docs.collegedesproducteurs.be/docs/intro#taxonomy-lists). Tags are used to group things without hierarchy based on a predefined list."
          type: array
          items:
            $ref: "#/components/schemas/Tag"
        product_weight:
          description: Weight of the product (see https://bdl217-docs.collegedesproducteurs.be/docs/intro#uom)
          type: object
          properties:
            key:
              description: The weight unit ref (code) (see https://bdl217-api.collegedesproducteurs.be/api/categories?type=uom&per_page=100)
              type: string
            type:
              description: The weight unit ref (type) (see https://bdl217-api.collegedesproducteurs.be/api/categories?type=uom&per_page=100)
              type: string
            value:
              description: The weight in number (no decimal), according to the unit defined in “code” (no decimals)
              type: integer
        product_dimensions:
          description: Dimension of the product (see https://bdl217-docs.collegedesproducteurs.be/docs/intro#uom)
          type: object
          properties:
            key:
              description: The dimension unit ref (code) (see https://bdl217-api.collegedesproducteurs.be/api/categories?type=uom&per_page=100)
              type: string
            type:
              description: The dimension unit ref (type) (see https://bdl217-api.collegedesproducteurs.be/api/categories?type=uom&per_page=100)
              type: string
            value:
              description: The dimension in number (no decimal), according to the unit defined in “code”
              type: integer
        allergens:
          allOf:
            - $ref: "#/components/schemas/AllergensList"
        nutritional_values:
          allOf:
            - $ref: "#/components/schemas/NutritionalValues"
        created_at:
          description: Date of creation of the product
          type: string
        updated_at:
          description: Date of last update of the product
          type: string
        images:
          description: URL to images of the product (first one is the main image)
          type: array
          items:
            $ref: "#/components/schemas/Image"
        visibility:
          allOf:
            - $ref: "#/components/schemas/Visibility"
            - description: The producer may have defined restrictions for some data gatherer categories (commercial segments) and/or give indication of self delivery restrictions (based on maximum distance between him and customers).
        updater:
          allOf:
            - $ref: "#/components/schemas/User"
            - description: The user id of the last user who updated the product
        seasonality:
          allOf:
            - $ref: "#/components/schemas/Seasonality"
            - description: Seasonality of the product
        life_expectancy_dmm:
          type: integer
          description: "Date de Durabilité Minimale (jours)"
        life_expectancy_dlc:
          type: integer
          description: "Date Limite de Consommation (jours)"
        life_expectancy_after_opening:
          type: integer
          description: "Durée de conservation après ouverture (jours)"
        storage_temperature_type:
          type: string
          description: "ref_id to take from : /api/tags?type=TradeItemTemperatureConditionTypeCodes"
        ce_approval_number:
          type: string
          description: "Numéro d'agrément CE"
        team:
          $ref: "#/components/schemas/Team"
    Seasonality:
      description: Seasonality of the product (from 0 (no availability) to 5 (max availability))
      type: object
      properties:
        january:
          type: integer
          minimum: 0
          maximum: 5
        february:
          type: integer
          minimum: 0
          maximum: 5
        march:
          type: integer
          minimum: 0
          maximum: 5
        april:
          type: integer
          minimum: 0
          maximum: 5
        may:
          type: integer
          minimum: 0
          maximum: 5
        june:
          type: integer
          minimum: 0
          maximum: 5
        july:
          type: integer
          minimum: 0
          maximum: 5
        augustus:
          type: integer
          minimum: 0
          maximum: 5
        september:
          type: integer
          minimum: 0
          maximum: 5
        october:
          type: integer
          minimum: 0
          maximum: 5
        november:
          type: integer
          minimum: 0
          maximum: 5
        december:
          type: integer
          minimum: 0
          maximum: 5
    ProductRequest:
      description: Common Product form request of a product (used for creation and update)
      type: object
      properties:
        id:
          description: Unique identifier of the product (in uuid v4 format). You can create a product with a specific uuid who should be unique (see https://www.uuidgenerator.net/)
          type: string
          format: uuid
        name:
          allOf:
            - description: Name of the product in multiple languages
            - $ref: "#/components/schemas/Translatable"
        team_id:
          description: The team id of the product
          type: integer
          format: int64
        creator_id:
          description: The creator id of the product (= user id)
          type: integer
          format: int64
        gtin:
          description: Global Trade Item Number (GS1) if available
          type: string
        create_gtin:
          type: boolean
          description: "Call the GS1 API to create a GTIN only if the team have GS1 subscription active (if not gtin will be null with a gtin_status error)"
        brand:
          description: Brand of the product (if it's branded internally in an another name)
          type: string
        external_id:
          description: External id of the product (used for an external reference from the producer)
          type: string
        external_type:
          description: External type of the product (used for an external reference from the producer)
          type: string
        description:
          allOf:
            - description: Description of the product in multiple languages
            - $ref: "#/components/schemas/Translatable"
        category:
          description: Main category of the product
          type: string
        tags:
          description: Tags related to the product (see https://bdl217-docs.collegedesproducteurs.be/docs/intro#taxonomy-lists)
          type: array
          items:
            type: integer
        product_weight:
          description: Weight of the product (see https://bdl217-docs.collegedesproducteurs.be/docs/intro#uom)
          type: object
          properties:
            key:
              description: The weight unit ref (code) (see https://bdl217-api.collegedesproducteurs.be/api/categories?type=uom&per_page=100)
              type: string
            type:
              description: The weight unit ref (type) (see https://bdl217-api.collegedesproducteurs.be/api/categories?type=uom&per_page=100)
              type: string
            value:
              description: The weight in number (no decimal), according to the unit defined in “code” (no decimals)
              type: integer
        product_dimensions:
          description: Dimension of the product (see https://bdl217-docs.collegedesproducteurs.be/docs/intro#uom)
          type: object
          properties:
            key:
              description: The dimension unit ref (code) (see https://bdl217-api.collegedesproducteurs.be/api/categories?type=uom&per_page=100)
              type: string
            type:
              description: The dimension unit ref (type) (see https://bdl217-api.collegedesproducteurs.be/api/categories?type=uom&per_page=100)
              type: string
            value:
              description: The dimension in number (no decimal), according to the unit defined in “code”
              type: integer
        allergens:
          allOf:
            - $ref: "#/components/schemas/AllergensList"
        nutritional_values:
          allOf:
            - $ref: "#/components/schemas/NutritionalValues"
        active:
          description: Define if the product is active or not. An inactive product can only be seen by the content managers for the product an dby the platform administrators, and is 'hidden' for any other user. Product.active attribute via API (PUT POST) -> back-end must force Product.active=false if team for this product is team.active=false
          type: boolean
        created_at:
          description: Date of creation of the product
          type: string
        updated_at:
          description: Date of last update of the product
          type: string
        images:
          description: Images of the product (first one is the main image)
          type: array
          items:
            $ref: "#/components/schemas/Image"
        volumes_stocks_availabilities:
          allOf:
            - description: Name of the product in multiple languages
            - $ref: "#/components/schemas/Translatable"
        life_expectancy_dmm:
          description: "Best Before Date (days)"
          type: integer
        life_expectancy_dlc:
          description: "Use-By Date (days)"
          type: integer
        life_expectancy_after_opening:
          description: "Life expectancy after opening (in days)"
        storage_temperature_type:
          description: "Storage temperature type (see https://bdl217-api.collegedesproducteurs.be/api/tags?type=TradeItemTemperatureConditionTypeCodes)"
        storage_temperature_value:
          description: "Storage temperature value"
        ce_approval_number:
          description: "CE Approval Number"
    ProductPostRequest:
      allOf:
        - $ref: "#/components/schemas/ProductRequest"
        - description: Product form request when creating a new product
          required:
            - name
            - team_id
            - creator_id
    ProductUpdateRequest:
      allOf:
        - $ref: "#/components/schemas/ProductRequest"
        - description: Product form request when updating a product
          required:
            - id
    AuthUser:
      description: Authenticated user object
      type: object
      properties:
        user:
          $ref: "#/components/schemas/User"
        access_token:
          description: JWT Api token for the user
          type: string
        token_type:
          type: string
    Error:
      type: object
      properties:
        message:
          type: string
          description: The given data was invalid.
        errors:
          description: Validation errors
          type: object
    Address:
      description: Address object that are part of a team
      type: object
      required:
        - address
        - model_type
        - model_id
        - name
        - role
      properties:
        id:
          type: string
        name:
          description: "The name of the address (possible suggested values: billing, shipping, main, etc...)"
          type: string
        address:
          description: "The full complete address (street, number, city, postcode, country)"
          type: string
        model_type:
          description: "The model type of the address (possible values: \\App\\Models\\Team, \\App\\Models\\User, \\App\\Models\\Product))"
          type: string
        model_id:
          description: "The model ID of the related model_type (possible value is the ID of the related model)"
          type: string
        country:
          type: string
        role:
          description: "Role of the address (possible suggested values: billing, shipping, main, etc...)"
          type: string
        organization:
          description: Organization name related to the address (if different from Team Name)
          type: string
        name_prefix:
          description: "Prefix of the name (e.g. Mr, Mrs, etc...)"
          type: string
        name_suffix:
          description: "Suffix of the name (e.g. Jr, Sr, etc...)"
          type: string
        first_name:
          description: "First name of the address"
          type: string
        last_name:
          description: "Last name of the address"
          type: string
        street:
          description: "Street of the address"
          type: string
        building_number:
          description: "Building number of the address"
          type: string
        building_flat:
          description: "Building flat of the address"
          type: string
        city:
          description: "City of the address"
          type: string
        city_prefix:
          description: "City prefix of the address"
          type: string
        city_suffix:
          description: "City suffix of the address"
          type: string
        state:
          description: "State of the address"
          type: string
        state_code:
          description: "State code of the address"
          type: string
        postcode:
          description: "Postcode of the address"
          type: string
        lat:
          description: "Latitude of the address"
          type: string
        lng:
          description: "Longitude of the address"
          type: string
        line1:
          description: "Address line 1 (will be automatically generated from the address field)"
          type: string
        line2:
          description: "Address line 2 (will be automatically generated from the address field)"
          type: string
        line3:
          description: "Address line 3 (will be automatically generated from the address field)"
          type: string
        created_at:
          description: Date of creation of the address
          type: string
        updated_at:
          description: Date of last update of the address
          type: string
    Translatable:
      description: "Object of translatable strings (please ensure that you manage correctly the type of the value). Keys are the language code (e.g. fr, nl, en, de). More infos on taxonomy here : https://bdl217-docs.collegedesproducteurs.be/docs/intro#taxonomy-lists"
      type: object
      properties:
        fr:
          description: Version française de cet attribut
          type: string
        nl:
          description: Nederlandse versie van deze veld
          type: string
        en:
          description: English version of this attribute
          type: string
        de:
          description: Deutsche Version dieses Attributs
          type: string
    KeyValueObject:
      description: "Object of key value objects that are not mandatory and not standardized (please ensure that you manage correctly the type of the value). More infos on taxonomy here : https://bdl217-docs.collegedesproducteurs.be/docs/intro#taxonomy-lists"
      type: object
      properties:
        key:
          type: string
        type:
          type: string
        value:
          type: string
    KeyValueArray:
      description: "Array of key value objects that are not mandatory and not standardized (please ensure that you manage correctly the type of the value). More infos on taxonomy here : https://bdl217-docs.collegedesproducteurs.be/docs/intro#taxonomy-lists"
      type: array
      items:
        $ref: "#/components/schemas/KeyValueObject"
    Image:
      description: Image object that are part of a team or a product
      type: object
      required:
        - src
      properties:
        src:
          description: URL of the image (GUI content providers will be able to upload images and have the URL set here. API content providers must mention a public image's URL.)
          type: string
        alt:
          description: Alt text of the image (if available)
          type: string
        ratio:
          description: Ratio of the image (e.g. 16:9, 4:3, etc...)
          type: string
        type:
          description: Type of the image (e.g. logo, main, etc...)
          type: string
    WhereQuery:
      type: object
      properties:
        column:
          description: column name to filter (depends on the entity)
          type: string
        operator:
          description: operator to use for the filter (could be =, !=, <, >, <=, >=, like, not like
          type: string
        value:
          description: value to filter
          type: string
    Visibility:
      description: Define who can see the object based on team_type categories of a team
      type: object
      properties:
        limit:
          description: Maximum distance (in kilometers) a producer agrees to cover to (self) deliver this product. Predefined thresholds are 25, 40 and 80 km. “everywhere” is valued as 0
          type: integer
        unauthorized:
          description: Define which team categories (commercial segments) cannot see this product. When consulting, content gatherer will not get the product infos if their own commercial segments is in this restriction list. In addition, this restriction list is provided to help "global" content gatherers target the (producer defined) product's intended business segments through a substractive (black list) approach.
          type: array
          items:
            allOf:
              - description: "List of unauthorized team_type categories (see : api/categories?type=team_type&per_page=100)"
              - $ref: "#/components/schemas/Category"
    Contact:
      description: Contact object that are part of a team
      type: object
      properties:
        name:
          description: Name of the contact
          type: string
        phone:
          description: Phone of the contact
          type: string
        mobile_phone:
          description: Mobile Phone of the contact
          type: string
        email:
          description: Email of the contact
          type: string
        role:
          description: Role of the contact
          type: string
        lang:
          description: Language of the contact
          type: string
        type:
          description: Type of the contact
          type: string
    NutritionalValues:
      description: Nutritional values of a product (number is in mg per 100g)
      type: object
      properties:
        fat:
          description: Fat value (number is in mg per 100g)
          type: string
        salt:
          description: Salt value (number is in mg per 100g)
          type: string
        sugar:
          description: Sugar value (number is in mg per 100g)
          type: string
        energy:
          description: Energy value (number is in kcal per 100g)
          type: string
        proteins:
          description: Proteins value (number is in mg per 100g)
          type: string
        carbohydrates:
          description: Carbohydrates value (number is in mg per 100g)
          type: string
        saturated_fat:
          description: Saturated fat value (number is in mg per 100g)
          type: string
    AllergensList:
      description: List of allergens present in the product (see https://eur-lex.europa.eu/legal-content/FR/TXT/?uri=celex%3A32011R1169)
      type: object
      properties:
        soy:
          type: boolean
          description: "If it contains soy as allergen"
        eggs:
          type: boolean
          description: "If it contains eggs as allergen"
        peanuts:
          type: boolean
          description: "If it contains peanuts as allergen"
        nuts:
          type: boolean
          description: "If it contains tree nuts as allergen"
        lupin:
          type: boolean
          description: "If it contains lupin as allergen"
        celery:
          type: boolean
          description: "If it contains celery as allergen"
        milk:
          type: boolean
          description: "If it contains milk as allergen"
        fish:
          type: boolean
          description: "If it contains fish as allergen"
        gluten:
          type: boolean
          description: "If it contains gluten as allergen"
        sesame:
          type: boolean
          description: "If it contains sesame as allergen"
        mustard:
          type: boolean
          description: "If it contains mustard as allergen"
        molluscs:
          type: boolean
          description: "If it contains molluscs as allergen"
        shellfish:
          type: boolean
          description: "If it contains shellfish as allergen"
        sulphur_dioxide:
          type: boolean
          description: "If it contains sulphur dioxide as allergen"
    GPC:
      description: Global Product Classification GS1 (see https://gpc-browser.gs1.org/)
      type: object
      properties:
        SegmentCode:
          description: Segment code GS1
          type: string
        SegmentTitle:
          description: Segment title GS1
          type: string
        SegmentDefinition:
          description: Segment definition GS1
          type: string
        FamilyCode:
          description: Family code GS1
          type: string
        FamilyTitle:
          description: Family title GS1
          type: string
        FamilyDefinition:
          description: Family definition GS1
          type: string
        ClassCode:
          description: Class code GS1
          type: string
        ClassTitle:
          description: Class title GS1
          type: string
        ClassDefinition:
          description: Class definition GS1
          type: string
        BrickCode:
          description: Brick code GS1
          type: string
        BrickTitle:
          description: Brick title GS1
          type: string
        BrickDefinition_Includes:
          description: Brick definition includes GS1
          type: string
        BrickDefinition_Excludes:
          description: Brick definition excludes GS1
          type: string
        AttributeCode:
          description: Attribute code GS1
          type: string
        AttributeTitle:
          description: Attribute title GS1
          type: string
        AttributeDefinition:
          description: Attribute definition GS1
          type: string
        AttributeValueCode:
          description: Attribute value code GS1
          type: string
        AttributeValueTitle:
          description: Attribute value title GS1
          type: string
        AttributeValueDefinition:
          description: Attribute value definition GS1
          type: string
