openapi: 3.0.0
info:
  title: Hello-michelin API
  description: This API has been created for Demo purpose API Hello Michelin.
  version: 1.0.0
  contact:
    name: API Team
    email: devportal.support@michelin.com
servers:
  - url: https://api-gvtcentral.michelin.com/p0r/v1
    description: PROD
tags:
  - name: Hello Michelin API

paths:
  /hello-michelin:
    get:
      tags:
        - Hello Michelin API
      summary: Returns Hello Michelin
      description: Generates a hello-michelin response.
      operationId: generate-hello-michelin
      security:
        - OAuth2:
          - p0r-hello-michelin-v1
      responses:
        '200':
          description: Successful response with Hello Michelin
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: "Hello Michelin"

        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'

        '401':
          description: Unauthorized - Authentication failed or was not provided
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse401'

        '429':
          description: Quota or Spike Arrest Violation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitErrorResponse'

        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse500'

components:
  securitySchemes:
    OAuth2:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: "https://indus.api.michelin.com/p0r/v1/internal/oauth/token/accesstoken?grant_type=client_credentials"
          scopes:
            p0r-hello-michelin-v1: "This scope grants access to read Hello Michelin data."

  schemas:
    ErrorResponse:
      type: object
      properties:
        message:
          type: string
          example: "An error occurred"
        http_status_code:
          type: integer
          example: 400

    ErrorResponse401:
      type: object
      properties:
        message:
          type: string
          example: "Unauthorized request"
        http_status_code:
          type: integer
          example: 401

    RateLimitErrorResponse:
      type: object
      properties:
        message:
          type: string
          description: "Message describing the rate limiting error"
          example: "Spike limit exceeded! You reached the limit of requests allowed in a specific time frame."
        http_status_code:
          type: integer
          example: 429
        violation_type:
          type: string
          example: "Quota Violation"
          description: "Specifies the type of violation (e.g., Spike Arrest, Quota Violation)"

    ErrorResponse500:
      type: object
      properties:
        message:
          type: string
          example: "Server unavailable"
        http_status_code:
          type: integer
          example: 500
