{
    "openapi": "3.0.3",
    "info": {
        "title": "JIT Data Commons API",
        "version": "1.0.0",
        "description": "Source-backed technical product data for electrical and solar equipment."
    },
    "servers": [
        {
            "url": "https://datasheet.jit.ng"
        }
    ],
    "paths": {
        "/api/v1/products": {
            "get": {
                "summary": "List products",
                "operationId": "listProducts",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Query"
                    },
                    {
                        "$ref": "#/components/parameters/Category"
                    },
                    {
                        "$ref": "#/components/parameters/Manufacturer"
                    },
                    {
                        "$ref": "#/components/parameters/Cursor"
                    },
                    {
                        "$ref": "#/components/parameters/Limit"
                    }
                ],
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/ProductsResponse"
                    },
                    "400": {
                        "$ref": "#/components/responses/Problem"
                    }
                }
            }
        },
        "/api/v1/products/{id}": {
            "get": {
                "summary": "Get a product",
                "operationId": "getProduct",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/ProductId"
                    }
                ],
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/ProductResponse"
                    },
                    "404": {
                        "$ref": "#/components/responses/Problem"
                    }
                }
            }
        },
        "/api/v1/search": {
            "get": {
                "summary": "Search products",
                "operationId": "searchProducts",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/Query"
                    },
                    {
                        "$ref": "#/components/parameters/Category"
                    },
                    {
                        "$ref": "#/components/parameters/Manufacturer"
                    }
                ],
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/ProductsResponse"
                    }
                }
            }
        },
        "/api/v1/compare": {
            "get": {
                "summary": "Compare products",
                "operationId": "compareProducts",
                "parameters": [
                    {
                        "name": "ids",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Comma-separated product identifiers."
                    }
                ],
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/ProductsResponse"
                    },
                    "400": {
                        "$ref": "#/components/responses/Problem"
                    }
                }
            }
        },
        "/api/v1/openapi.json": {
            "get": {
                "summary": "Get the OpenAPI contract",
                "operationId": "getOpenApiContract",
                "responses": {
                    "200": {
                        "description": "OpenAPI contract",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/v1/auth/register": {
            "post": {
                "summary": "Register an account",
                "operationId": "register",
                "requestBody": {
                    "$ref": "#/components/requestBodies/JsonBody"
                },
                "responses": {
                    "201": {
                        "$ref": "#/components/responses/Json"
                    },
                    "400": {
                        "$ref": "#/components/responses/Problem"
                    }
                }
            }
        },
        "/api/v1/auth/login": {
            "post": {
                "summary": "Log in",
                "operationId": "login",
                "requestBody": {
                    "$ref": "#/components/requestBodies/JsonBody"
                },
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/Json"
                    },
                    "401": {
                        "$ref": "#/components/responses/Problem"
                    }
                }
            }
        },
        "/api/v1/developer/keys": {
            "get": {
                "summary": "List API keys",
                "operationId": "listApiKeys",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "responses": {
                    "200": {
                        "$ref": "#/components/responses/Json"
                    },
                    "401": {
                        "$ref": "#/components/responses/Problem"
                    }
                }
            },
            "post": {
                "summary": "Create an API key",
                "operationId": "createApiKey",
                "security": [
                    {
                        "bearerAuth": []
                    }
                ],
                "requestBody": {
                    "$ref": "#/components/requestBodies/JsonBody"
                },
                "responses": {
                    "201": {
                        "$ref": "#/components/responses/Json"
                    },
                    "401": {
                        "$ref": "#/components/responses/Problem"
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "scheme": "bearer",
                "bearerFormat": "API key"
            }
        },
        "parameters": {
            "ProductId": {
                "name": "id",
                "in": "path",
                "required": true,
                "schema": {
                    "type": "string"
                }
            },
            "Query": {
                "name": "q",
                "in": "query",
                "schema": {
                    "type": "string"
                }
            },
            "Category": {
                "name": "category",
                "in": "query",
                "schema": {
                    "type": "string"
                }
            },
            "Manufacturer": {
                "name": "manufacturer",
                "in": "query",
                "schema": {
                    "type": "string"
                }
            },
            "Cursor": {
                "name": "cursor",
                "in": "query",
                "schema": {
                    "type": "string"
                }
            },
            "Limit": {
                "name": "limit",
                "in": "query",
                "schema": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "default": 20
                }
            }
        },
        "requestBodies": {
            "JsonBody": {
                "required": true,
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    }
                }
            }
        },
        "responses": {
            "Json": {
                "description": "JSON response",
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    }
                }
            },
            "ProductResponse": {
                "description": "Product record",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Product"
                        }
                    }
                }
            },
            "ProductsResponse": {
                "description": "Product collection",
                "content": {
                    "application/json": {
                        "schema": {
                            "type": "object",
                            "additionalProperties": true
                        }
                    }
                }
            },
            "Problem": {
                "description": "Problem details",
                "content": {
                    "application/problem+json": {
                        "schema": {
                            "$ref": "#/components/schemas/Problem"
                        }
                    }
                }
            }
        },
        "schemas": {
            "Product": {
                "type": "object",
                "additionalProperties": true,
                "properties": {
                    "id": {
                        "type": "string"
                    },
                    "model": {
                        "type": "string"
                    },
                    "manufacturer": {
                        "type": "string"
                    },
                    "category": {
                        "type": "string"
                    }
                }
            },
            "Problem": {
                "type": "object",
                "required": [
                    "type",
                    "title",
                    "status",
                    "detail"
                ],
                "properties": {
                    "type": {
                        "type": "string",
                        "format": "uri-reference"
                    },
                    "title": {
                        "type": "string"
                    },
                    "status": {
                        "type": "integer"
                    },
                    "detail": {
                        "type": "string"
                    },
                    "instance": {
                        "type": "string"
                    }
                }
            }
        }
    }
}