info:
  description: |
    API for calculating the difference between two dates.

    **Authentication Options**:
    - Recommended: Bearer token via `Authorization` header.
    - Fallback (GET): `token` query parameter.
    - Fallback (POST): `apiKey` in JSON body.
  title: Date Difference Calculator API
  version: 1.1.0
openapi: 3.0.0
paths:
  /api/v1/date-difference-calculator:
    post:
      requestBody:
        content:
          application/json:
            schema:
              properties:
                apiKey:
                  type: string
                date1:
                  format: date
                  type: string
                date2:
                  format: date
                  type: string
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  difference:
                    properties:
                      days:
                        type: integer
                      months:
                        type: integer
                      years:
                        type: integer
                    type: object
                type: object
          description: Successful response
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '429':
          description: Too many requests
      summary: Calculate the difference between two dates.
    get:
      parameters:
        - in: query
          name: date1
          schema:
            type: string
            format: date
          required: true
          description: The first date (e.g., 2023-01-01).
        - in: query
          name: date2
          schema:
            type: string
            format: date
          required: true
          description: The second date (e.g., 2023-12-31).
        - in: query
          name: token
          schema:
            type: string
          required: false
          description: Fallback authentication token.
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  difference:
                    properties:
                      days:
                        type: integer
                      months:
                        type: integer
                      years:
                        type: integer
                    type: object
                type: object
          description: Successful response
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '429':
          description: Too many requests
      summary: Calculate the difference between two dates using GET.
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

security:
  - bearerAuth: []  # Global security, but overridden per-path
servers:
- url: https://infinitode.netlify.app
