openapi: 3.0.0
info:
  title: Beehive Quest API
  description: API created for the Quest purpose
  version: 1.0.0
  contact:
    name: TeamAPIQuest
    email: abc.michelin@com
    url: 'https://indus.developer.michelin.com/en/contact'

servers:
  - url: https://mock-dev.api.michelin.net/rest/Beehive+API/1.0.0
  - url: https://dev.api.michelin.com/beehive-quest-api/yourTeamName

tags:
  - name: Beehive
    description: API Quest
security:
    - OAuth2Production: [dot-image-recognition]
paths:
  /hives:
    get:

      tags:
        - Beehive
      summary: Get Hive Information
      description: Retrieves information about available hives.
      operationId: getHives
      required: true
      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/{hiveid}:
    get:
      operationId: Hives_read
      parameters:
        - name: hiveid
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: The request has succeeded.
          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

        '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"
                }


components:
  parameters:
    ApiKey:
      name: apikey
      in: header
      schema:
        type: string
      required: true
  securitySchemes:
    OAuth2Production:
      type: oauth2
      description: This is the OAuth2 security scheme for the production environment
      flows:
        clientCredentials:
          tokenUrl: https://api.michelin.com/idp-rfc-compliant/v1/internal/oauth/token/accesstoken?grant_type=client_credentials
          scopes:
            dot-image-recognition: This scope grants access to the DOT image recognition API
  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
    ProxyErrorResponse:
      type: object
      properties:
        fault: 
          type: object
          properties: 
            faultstring: 
              type: string
            detail: 
              type: object
              properties: 
                errorcode: 
                  type: string


