{
  "openapi": "3.1.0",
  "info": {
    "title": "Custom Cover Company public read API",
    "version": "1.0.0",
    "description": "Anonymous, read-only published product data. No order, customer, payment or internal supplier records. Confirm current final price and availability on the website."
  },
  "servers": [
    {
      "url": "https://customcover.uk"
    }
  ],
  "paths": {
    "/api/products.json": {
      "get": {
        "operationId": "listProducts",
        "summary": "List public products",
        "responses": {
          "200": {
            "description": "Successful public read",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "version",
                    "currency",
                    "count",
                    "products"
                  ],
                  "properties": {
                    "version": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "count": {
                      "type": "integer"
                    },
                    "products": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Product"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/products/{slug}.json": {
      "get": {
        "operationId": "getProduct",
        "summary": "Get a public product",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful public read",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Product"
                }
              }
            }
          },
          "404": {
            "description": "Unknown product slug; static host returns an HTML error page."
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Product": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "slug",
          "title",
          "pricing_type",
          "price",
          "currency",
          "availability",
          "url",
          "json_url",
          "description"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "pricing_type": {
            "type": "string",
            "enum": [
              "fixed",
              "base_price"
            ],
            "description": "base_price excludes optional lead-time surcharges; confirm final price on the product page."
          },
          "price": {
            "type": "number",
            "minimum": 0
          },
          "currency": {
            "type": "string",
            "enum": [
              "GBP"
            ]
          },
          "availability": {
            "type": "string",
            "enum": [
              "made_to_order",
              "in_stock"
            ],
            "description": "Published storefront status, not a reservation or live stock guarantee."
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "json_url": {
            "type": "string",
            "format": "uri"
          },
          "description": {
            "type": "string"
          }
        }
      }
    }
  }
}
