{
	"openapi": "3.0.0",
	"info": {
		"title": "Product Zone API",
		"description": "API for accessing product information including headwear, beanies, and accessories",
		"version": "1.0.0"
	},
	"paths": {
		"/api/products": {
			"get": {
				"summary": "Get Products",
				"description": "Retrieve a list of products with optional filtering and pagination",
				"parameters": [
					{
						"name": "product_type",
						"in": "query",
						"description": "Filter by product type (case-insensitive)",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"Caps",
								"Beanies",
								"Bucket Hats",
								"Jacquard Bobble Hats",
								"Jacquard Scarves"
							]
						}
					},
					{
						"name": "style",
						"in": "query",
						"description": "Filter by style (case-insensitive)",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"6-Panel",
								"5-Panel",
								"Snapback",
								"Trucker",
								"Eco",
								"None"
							]
						}
					},
					{
						"name": "colour",
						"in": "query",
						"description": "Filter by colour (case-insensitive)",
						"required": false,
						"schema": {
							"type": "string",
							"enum": [
								"Black",
								"Bottle Green",
								"Burgundy",
								"Charcoal",
								"Emerald",
								"Gold",
								"Light Grey",
								"Navy",
								"Olive",
								"Red",
								"Royal",
								"White",
								"Pink",
								"Orange",
								"Cream",
								"Grey",
								"Turquoise",
								"Brown",
								"Yellow",
								"Purple",
								"Sky Blue",
								"Lime"
							]
						}
					},
					{
						"name": "size",
						"in": "query",
						"description": "Filter by size (case-insensitive)",
						"required": false,
						"schema": {
							"type": "string",
							"enum": ["Adult", "Junior"]
						}
					},
					{
						"name": "first",
						"in": "query",
						"description": "Number of products to return (pagination)",
						"required": false,
						"schema": {
							"type": "integer",
							"default": 10,
							"minimum": 1,
							"maximum": 100
						}
					},
					{
						"name": "after",
						"in": "query",
						"description": "Cursor for pagination",
						"required": false,
						"schema": {
							"type": "string"
						}
					}
				],
				"responses": {
					"200": {
						"description": "List of products",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ProductResponse"
								}
							}
						}
					},
					"404": {
						"description": "No products found",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorResponse"
								}
							}
						}
					},
					"429": {
						"description": "Rate limit exceeded",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorResponse"
								}
							}
						}
					},
					"500": {
						"description": "Internal server error",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorResponse"
								}
							}
						}
					}
				}
			}
		}
	},
	"components": {
		"schemas": {
			"ProductResponse": {
				"type": "object",
				"properties": {
					"edges": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/ProductEdge"
						}
					},
					"pageInfo": {
						"$ref": "#/components/schemas/PageInfo"
					}
				},
				"required": ["edges", "pageInfo"]
			},
			"ProductEdge": {
				"type": "object",
				"properties": {
					"node": {
						"$ref": "#/components/schemas/Product"
					}
				},
				"required": ["node"]
			},
			"Product": {
				"type": "object",
				"properties": {
					"_meta": {
						"$ref": "#/components/schemas/ProductMeta"
					},
					"title": {
						"type": "string",
						"description": "Product title/code",
						"example": "PZ001"
					},
					"description": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/RichTextBlock"
						},
						"description": "Rich text description of the product"
					},
					"product_type": {
						"type": "string",
						"description": "The type/category of the product",
						"example": "Caps"
					},
					"styles": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/ProductStyle"
						},
						"description": "Available styles for this product"
					},
					"sizes": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/ProductSize"
						},
						"description": "Available sizes for this product"
					},
					"images": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/ProductImage"
						},
						"description": "Product images"
					},
					"colours": {
						"type": "array",
						"items": {
							"$ref": "#/components/schemas/ProductColour"
						},
						"description": "Available colours for this product"
					}
				},
				"required": ["_meta", "title", "product_type"]
			},
			"ProductMeta": {
				"type": "object",
				"properties": {
					"uid": {
						"type": "string",
						"description": "Unique identifier for the product",
						"example": "pz001"
					}
				},
				"required": ["uid"]
			},
			"RichTextBlock": {
				"type": "object",
				"properties": {
					"type": {
						"type": "string",
						"description": "Type of content block",
						"example": "paragraph"
					},
					"text": {
						"type": "string",
						"description": "Text content of the block"
					},
					"spans": {
						"type": "array",
						"items": {
							"type": "object"
						},
						"description": "Text formatting spans"
					}
				},
				"required": ["type", "text", "spans"]
			},
			"ProductStyle": {
				"type": "object",
				"properties": {
					"style": {
						"type": "string",
						"nullable": true,
						"description": "Style name",
						"example": "6-Panel"
					}
				}
			},
			"ProductSize": {
				"type": "object",
				"properties": {
					"size": {
						"type": "string",
						"description": "Size name",
						"example": "Adult"
					}
				},
				"required": ["size"]
			},
			"ProductImage": {
				"type": "object",
				"properties": {
					"position": {
						"type": "string",
						"description": "Image position/view",
						"example": "Side"
					},
					"colour": {
						"type": "string",
						"description": "Colour variant shown in image",
						"example": "Charcoal"
					},
					"image": {
						"$ref": "#/components/schemas/ImageDetails"
					}
				},
				"required": ["position", "colour", "image"]
			},
			"ImageDetails": {
				"type": "object",
				"properties": {
					"dimensions": {
						"$ref": "#/components/schemas/ImageDimensions"
					},
					"alt": {
						"type": "string",
						"nullable": true,
						"description": "Alt text for the image"
					},
					"copyright": {
						"type": "string",
						"nullable": true,
						"description": "Copyright information"
					},
					"url": {
						"type": "string",
						"format": "uri",
						"description": "URL of the image",
						"example": "https://images.prismic.io/product-zone/example.jpg"
					}
				},
				"required": ["dimensions", "url"]
			},
			"ImageDimensions": {
				"type": "object",
				"properties": {
					"width": {
						"type": "integer",
						"description": "Image width in pixels",
						"example": 2650
					},
					"height": {
						"type": "integer",
						"description": "Image height in pixels",
						"example": 2015
					}
				},
				"required": ["width", "height"]
			},
			"ProductColour": {
				"type": "object",
				"properties": {
					"colour": {
						"type": "string",
						"description": "Colour name",
						"example": "Black"
					}
				},
				"required": ["colour"]
			},
			"PageInfo": {
				"type": "object",
				"properties": {
					"endCursor": {
						"type": "string",
						"nullable": true,
						"description": "Cursor for the last item in this page",
						"example": "YXJyYXljb25uZWN0aW9uOjk="
					},
					"hasNextPage": {
						"type": "boolean",
						"description": "Whether there are more pages available",
						"example": true
					}
				},
				"required": ["hasNextPage"]
			},
			"ErrorResponse": {
				"type": "object",
				"properties": {
					"message": {
						"type": "string",
						"description": "Error message",
						"example": "No products found"
					},
					"error": {
						"type": "string",
						"description": "Detailed error information (only in 500 responses)"
					}
				},
				"required": ["message"]
			}
		}
	}
}
