openapi: 3.0.0
info:
  title: Beehive API
  description: API created for the Quest purpose
  version: 1.0.0
  contact:
    name: ABC
    email: abc.michelin@com
    url: https://test.com

servers:
  - url: https://api.example.com/teamName/v1
    description: Development environment

#security:
#  - ApiKeyAuth: []

tags:
  - name: Beehive
    description: API Quest

paths:
  /hives:
    get:
      tags:
        - Beehive
      summary: Get Hive Information
      description: Retrieves information about available hives.
      operationId: getHives
      responses:
        '200':
          description: Successful response with hive details
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Hive'
              examples:
                success:
                  value:
                    hives:
                    - id: hive_15489 
                      location: "45.78332540796949, 3.092918430685111"
                      type: "Langstroth"
                      bee_breed: "Black bee"
                      population: 6789
                    - id: hive_47897
                      location: "45.78332540796949, 3.092918430685111"
                      type: "Walle"
                      bee_breed": "Buckfast"
                      population: 14520

  /hives/{hive_id}:
    get:
      operationId: Hives_read
      parameters:
        - name: hive_id
          in: path
          required: true
          schema:
            type: string

            
      responses:
        '200':
          description: The request has succeeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Hive'

        '401':
          description: Unauthorised error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProxyErrorResponse'
              example: |-
                {
                    "fault": {
                        "faultstring": "Invalid ApiKey",
                        "detail": {
                            "errorcode": "oauth.v2.InvalidApiKey"
                        }
                    }
                }
        '400':
          description: Client-side error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProxyErrorResponse'
              example: |-
                {
                  "code": "400",
                  "message": "Bad request"
                }

#      security:
#        - ApiKeyAuth: []

components:
  schemas:
    Hive:
      type: object
      required:
        - hive_id
        - type
        - population
        - bee_breed
        - location
      properties:
        hive_id:
          type: integer
          format: int32
        type:
          $ref: '#/components/schemas/HiveType'
        population:
          type: integer
          format: int32
        bee_breed:
          type: integer
        location:
          type: string
    HiveType:
      type: string
      enum:
        - Langstroth
        - Warre
        - Top Bar
        - Unknown
    ErrorResponse:
      type: object
      properties:
        code:
          type: integer
          example: 401
        message:
          type: string
          example: APIGEE Authentication error
    ProxyErrorResponse:
      type: object
      properties:
        fault: 
          type: object
          properties: 
            faultstring: 
              type: string
            detail: 
              type: object
              properties: 
                errorcode: 
                  type: string


#  securitySchemes:
#   ApiKeyAuth:
#     type: apiKey
#     in: header
#      name: apikey

externalDocs:
  description: Find more information here
  url: https://developer.example.com/docs


