{
  "openapi": "3.1.0",
  "info": {
    "title": "MedCourse India Agent API",
    "description": "API for AI agents to discover medical workshops and generate checkout links for users, supporting Agentic Commerce.",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://medcourse.in",
      "description": "Production Server"
    }
  ],
  "paths": {
    "/api/workshops": {
      "get": {
        "operationId": "getWorkshops",
        "summary": "List upcoming workshops",
        "description": "Retrieve a list of upcoming BLS, ACLS, and PALS workshops with available seats and prices.",
        "responses": {
          "200": {
            "description": "A list of workshops",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "occurrence_id": {
                        "type": "string"
                      },
                      "workshop_title": {
                        "type": "string"
                      },
                      "venue_city": {
                        "type": "string"
                      },
                      "starts_at": {
                        "type": "string",
                        "format": "date-time"
                      },
                      "seats_available": {
                        "type": "integer"
                      },
                      "price": {
                        "type": "number"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/agent-checkout": {
      "post": {
        "operationId": "createCheckoutLink",
        "summary": "Create a payment checkout link",
        "description": "Generates a direct payment link for an agent to present to the user for a specific workshop occurrence.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "occurrence_id",
                  "email",
                  "name",
                  "phone",
                  "seats"
                ],
                "properties": {
                  "occurrence_id": {
                    "type": "string",
                    "description": "The ID of the workshop occurrence"
                  },
                  "seats": {
                    "type": "integer",
                    "description": "Number of seats to book"
                  },
                  "name": {
                    "type": "string",
                    "description": "Full name of the candidate"
                  },
                  "email": {
                    "type": "string",
                    "description": "Email address of the candidate"
                  },
                  "phone": {
                    "type": "string",
                    "description": "Phone number of the candidate"
                  },
                  "notes": {
                    "type": "string",
                    "description": "Any special instructions or notes"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Checkout link generated successfully",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "payment_link_url": {
                      "type": "string",
                      "description": "Direct URL for the user to complete payment"
                    },
                    "order_id": {
                      "type": "string",
                      "description": "Internal order reference ID"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}