{
  "openapi": "3.1.0",
  "info": {
    "title": "Forema Public Store API",
    "version": "1.0.0",
    "description": "Read-only public storefront information and published product listings. No customer, cart, order, payment or administrator actions are exposed."
  },
  "servers": [
    {
      "url": "https://foremaxo.com"
    }
  ],
  "paths": {
    "/api/agent/info": {
      "get": {
        "operationId": "getForemaStoreInfo",
        "summary": "Read Forema store details",
        "description": "Return the public store identity, contact channels and storefront links without authentication.",
        "responses": {
          "200": {
            "description": "Public Forema store details",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StoreInfo"
                }
              }
            }
          }
        }
      }
    },
    "/api/agent/products": {
      "get": {
        "operationId": "listForemaPublicProducts",
        "summary": "List published Forema products",
        "description": "Page through products made available by the public Medusa store catalogue. Does not expose customer or private inventory data.",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "1-based page number (1–1000).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000,
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum results per page (1–24).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 24,
              "default": 12
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Published product summaries",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "items",
                    "count",
                    "next_page"
                  ],
                  "properties": {
                    "items": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Product"
                      }
                    },
                    "count": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "next_page": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "minimum": 1
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid page or limit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "503": {
            "description": "Public product service temporarily unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "StoreInfo": {
        "type": "object",
        "required": [
          "name",
          "description",
          "website",
          "categories",
          "contact",
          "links"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "website": {
            "type": "string",
            "format": "uri"
          },
          "categories": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "contact": {
            "type": "object",
            "properties": {
              "email": {
                "type": "string",
                "format": "email"
              },
              "phone": {
                "type": "string"
              }
            }
          },
          "links": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "format": "uri"
            }
          }
        }
      },
      "Product": {
        "type": "object",
        "required": [
          "id",
          "title",
          "handle",
          "url"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "handle": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "thumbnail": {
            "type": [
              "string",
              "null"
            ]
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "ApiError": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "code",
              "message",
              "hint"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "hint": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}
