{
  "openapi": "3.0.3",
  "info": {
    "title": "Tsuyo Gymwear Public API",
    "version": "1.0.0",
    "description": "Read-only public gymwear catalog, MYR prices, store configuration and public help pages. No authentication required. Preview pieces are illustrative. This API never creates orders, charges cards or exposes customer records.",
    "contact": {
      "name": "Tsuyo",
      "email": "admin@tsuyo.com",
      "url": "https://tsuyo.vercel.app/contact"
    }
  },
  "servers": [
    {
      "url": "https://tsuyo.vercel.app",
      "description": "Canonical Tsuyo production origin"
    }
  ],
  "externalDocs": {
    "description": "Tsuyo API & agent usage, authentication and errors",
    "url": "https://tsuyo.vercel.app/docs"
  },
  "security": [],
  "paths": {
    "/api": {
      "get": {
        "operationId": "getApiIndex",
        "summary": "Discover Tsuyo’s read-only API and documentation URLs",
        "description": "Discover Tsuyo’s read-only API and documentation URLs.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Public read succeeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiIndex"
                }
              }
            }
          },
          "400": {
            "description": "Structured problem. Correct input, consult docs, or honor Retry-After for 503.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Structured problem. Correct input, consult docs, or honor Retry-After for 503.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "Structured problem. Correct input, consult docs, or honor Retry-After for 503.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Structured problem. Correct input, consult docs, or honor Retry-After for 503.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "/api/products": {
      "get": {
        "operationId": "searchProducts",
        "summary": "Search public Tsuyo gymwear by name, colour, type or category",
        "description": "Search public Tsuyo gymwear by name, colour, type or category. Paginated results explicitly identify previews; a result is not a stock reservation.",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "description": "Case-insensitive name, colour or type substring.",
            "schema": {
              "type": "string",
              "maxLength": 100,
              "default": ""
            }
          },
          {
            "name": "category",
            "in": "query",
            "required": false,
            "description": "Public collection category.",
            "schema": {
              "type": "string",
              "enum": [
                "men",
                "women",
                "unisex"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum results to return.",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "description": "Number of matched results to skip.",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 10000,
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Public read succeeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductSearch"
                }
              }
            }
          },
          "400": {
            "description": "Structured problem. Correct input, consult docs, or honor Retry-After for 503.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Structured problem. Correct input, consult docs, or honor Retry-After for 503.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "Structured problem. Correct input, consult docs, or honor Retry-After for 503.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Structured problem. Correct input, consult docs, or honor Retry-After for 503.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "/api/products/{id}": {
      "get": {
        "operationId": "getProduct",
        "summary": "Read a public product, including MYR minor-unit price, sizes, fit, care and availability flags",
        "description": "Read a public product, including MYR minor-unit price, sizes, fit, care and availability flags. Preview products are illustrative.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Product id obtained from searchProducts.",
            "schema": {
              "type": "string",
              "pattern": "^[a-z0-9-]+$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Public read succeeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Product"
                }
              }
            }
          },
          "400": {
            "description": "Structured problem. Correct input, consult docs, or honor Retry-After for 503.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Structured problem. Correct input, consult docs, or honor Retry-After for 503.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "Structured problem. Correct input, consult docs, or honor Retry-After for 503.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Structured problem. Correct input, consult docs, or honor Retry-After for 503.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "/api/store": {
      "get": {
        "operationId": "getStoreStatus",
        "summary": "Check whether checkout, Stripe sandbox or live payments, and delivery zones are configured",
        "description": "Check whether checkout, Stripe sandbox or live payments, and delivery zones are configured. Recheck before planning a purchase.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Public read succeeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StoreStatus"
                }
              }
            }
          },
          "400": {
            "description": "Structured problem. Correct input, consult docs, or honor Retry-After for 503.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Structured problem. Correct input, consult docs, or honor Retry-After for 503.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "Structured problem. Correct input, consult docs, or honor Retry-After for 503.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Structured problem. Correct input, consult docs, or honor Retry-After for 503.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    },
    "/api/pages": {
      "get": {
        "operationId": "readPublicPage",
        "summary": "Read an enumerated public trust or developer page as Markdown in JSON",
        "description": "Read an enumerated public trust or developer page as Markdown in JSON. No private account, customer, order or admin content is accessible.",
        "parameters": [
          {
            "name": "path",
            "in": "query",
            "required": true,
            "description": "Canonical public information page.",
            "schema": {
              "type": "string",
              "enum": [
                "/about",
                "/contact",
                "/privacy",
                "/docs",
                "/docs/auth",
                "/docs/errors"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Public read succeeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicPage"
                }
              }
            }
          },
          "400": {
            "description": "Structured problem. Correct input, consult docs, or honor Retry-After for 503.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "Structured problem. Correct input, consult docs, or honor Retry-After for 503.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "405": {
            "description": "Structured problem. Correct input, consult docs, or honor Retry-After for 503.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "Structured problem. Correct input, consult docs, or honor Retry-After for 503.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before retrying.",
                "schema": {
                  "type": "integer"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Problem": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "type",
          "title",
          "status",
          "code",
          "message",
          "detail",
          "resolution"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "about:blank"
            ]
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer",
            "minimum": 400,
            "maximum": 599
          },
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "detail": {
            "type": "string"
          },
          "resolution": {
            "type": "string"
          }
        }
      },
      "Variant": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "size",
          "price_minor",
          "available"
        ],
        "properties": {
          "size": {
            "type": "string"
          },
          "price_minor": {
            "type": "integer",
            "minimum": 1,
            "description": "Integer MYR minor units."
          },
          "available": {
            "type": "boolean"
          }
        }
      },
      "Product": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "name",
          "description",
          "category",
          "type",
          "color",
          "price_minor",
          "currency",
          "preview",
          "available",
          "variants",
          "fit",
          "details",
          "care",
          "image_url",
          "url"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "category": {
            "type": "string",
            "enum": [
              "men",
              "women",
              "unisex"
            ]
          },
          "type": {
            "type": "string"
          },
          "color": {
            "type": "string"
          },
          "price_minor": {
            "type": "integer",
            "minimum": 1,
            "description": "Integer MYR minor units: 14900 is RM 149.00."
          },
          "currency": {
            "type": "string",
            "enum": [
              "MYR"
            ]
          },
          "preview": {
            "type": "boolean",
            "description": "Illustrative product, not a fulfilment offer."
          },
          "available": {
            "type": "boolean"
          },
          "variants": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Variant"
            }
          },
          "fit": {
            "type": "string"
          },
          "details": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "care": {
            "type": "string"
          },
          "image_url": {
            "type": "string",
            "format": "uri"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        }
      },
      "ProductSearch": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "products",
          "total",
          "limit",
          "offset"
        ],
        "properties": {
          "products": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Product"
            }
          },
          "total": {
            "type": "integer",
            "minimum": 0
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 50
          },
          "offset": {
            "type": "integer",
            "minimum": 0
          }
        }
      },
      "ShippingZone": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "countries",
          "regions",
          "fee_minor",
          "free_over_minor"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "countries": {
            "type": "array",
            "items": {
              "type": "string",
              "pattern": "^[A-Z]{2}$"
            }
          },
          "regions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "fee_minor": {
            "type": "integer",
            "minimum": 0
          },
          "free_over_minor": {
            "type": "integer",
            "minimum": 0,
            "nullable": true
          }
        }
      },
      "StoreStatus": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "url",
          "currency",
          "preview",
          "checkout_enabled",
          "payment_mode",
          "payments_configured",
          "sandbox_bag_enabled",
          "shipping_configured",
          "shipping_zones",
          "notice"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "currency": {
            "type": "string",
            "enum": [
              "MYR"
            ]
          },
          "preview": {
            "type": "boolean"
          },
          "checkout_enabled": {
            "type": "boolean"
          },
          "payment_mode": {
            "type": "string",
            "enum": [
              "test",
              "live",
              "unknown"
            ]
          },
          "payments_configured": {
            "type": "boolean"
          },
          "sandbox_bag_enabled": {
            "type": "boolean"
          },
          "shipping_configured": {
            "type": "boolean"
          },
          "shipping_zones": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ShippingZone"
            }
          },
          "notice": {
            "type": "string"
          }
        }
      },
      "PublicPage": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "path",
          "url",
          "markdown"
        ],
        "properties": {
          "path": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "markdown": {
            "type": "string"
          }
        }
      },
      "ApiIndex": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "version",
          "authentication",
          "read_only",
          "documentation",
          "openapi",
          "mcp",
          "endpoints"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "authentication": {
            "type": "string",
            "enum": [
              "none"
            ]
          },
          "read_only": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "documentation": {
            "type": "string",
            "format": "uri"
          },
          "openapi": {
            "type": "string",
            "format": "uri"
          },
          "mcp": {
            "type": "string",
            "format": "uri"
          },
          "endpoints": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      }
    }
  }
}
