{
  "openapi": "3.1.1",
  "info": {
    "title": "Wildmart Public Product Discovery API",
    "version": "1.0.0",
    "description": "Read-only discovery of products currently published on Wildmart. Product links lead to the storefront for current information and purchasing."
  },
  "servers": [{"url": "https://wildmart.md/api/public/v1"}],
  "security": [],
  "tags": [{"name":"Discovery"},{"name":"Products"},{"name":"Dimensions"}],
  "paths": {
    "/": {"get":{"tags":["Discovery"],"operationId":"getServiceIndex","summary":"Discover API endpoints","responses":{"200":{"description":"Service index","content":{"application/json":{"schema":{"type":"object"}}}}}}},
    "/status": {"get":{"tags":["Discovery"],"operationId":"getStatus","summary":"Get public projection readiness","responses":{"200":{"description":"Ready or degraded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Status"}}}},"503":{"$ref":"#/components/responses/Unavailable"}}}},
    "/store": {"get":{"tags":["Discovery"],"operationId":"getStore","summary":"Get public store identity and policies","description":"Public store identity. Existing website and policies fields use Russian canonical URLs. localizations contains RU/RO website, policies, Markdown homepage and llms discovery links from the published projection.","responses":{"200":{"description":"Store information","content":{"application/json":{"schema":{"type":"object"}}}}}}},
    "/products": {"get":{"tags":["Products"],"operationId":"listProducts","summary":"Search or list published products","parameters":[{"$ref":"#/components/parameters/Language"},{"name":"q","in":"query","description":"Product name, brand, model or code; 2-120 characters.","schema":{"type":"string","minLength":2,"maxLength":120}},{"name":"category_id","in":"query","description":"Include products in this published category or published descendants.","schema":{"type":"integer","minimum":1}},{"name":"brand_id","in":"query","schema":{"type":"integer","minimum":1}},{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"}],"responses":{"200":{"description":"Product page","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductPage"}}}},"400":{"$ref":"#/components/responses/Problem"},"410":{"$ref":"#/components/responses/Problem"},"429":{"$ref":"#/components/responses/Problem"},"503":{"$ref":"#/components/responses/Unavailable"}}}},
    "/products/{product_id}": {"get":{"tags":["Products"],"operationId":"getProduct","summary":"Get one published product","parameters":[{"name":"product_id","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"$ref":"#/components/parameters/Language"}],"responses":{"200":{"description":"Product","content":{"application/json":{"schema":{"type":"object","required":["item","data_updated_at"],"properties":{"item":{"$ref":"#/components/schemas/Product"},"data_updated_at":{"type":"string","format":"date-time"}}}}}},"404":{"$ref":"#/components/responses/Problem"},"503":{"$ref":"#/components/responses/Unavailable"}}}},
    "/categories": {"get":{"tags":["Dimensions"],"operationId":"listCategories","summary":"List published categories","parameters":[{"$ref":"#/components/parameters/Language"},{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"}],"responses":{"200":{"description":"Category page","content":{"application/json":{"schema":{"type":"object"}}}},"410":{"$ref":"#/components/responses/Problem"}}}},
    "/brands": {"get":{"tags":["Dimensions"],"operationId":"listBrands","summary":"List brands represented by published products","parameters":[{"$ref":"#/components/parameters/Language"},{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"}],"responses":{"200":{"description":"Brand page","content":{"application/json":{"schema":{"type":"object"}}}},"410":{"$ref":"#/components/responses/Problem"}}}}
  },
  "components": {
    "parameters": {
      "Language":{"name":"lang","in":"query","description":"Response language. Russian is the default.","schema":{"type":"string","enum":["ru","ro"],"default":"ru"}},
      "Limit":{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":20,"default":10}},
      "Cursor":{"name":"cursor","in":"query","description":"Opaque cursor returned by the preceding response. Do not modify it.","schema":{"type":"string","maxLength":1100}}
    },
    "schemas": {
      "Status":{"type":"object","required":["status","data_updated_at"],"properties":{"status":{"type":"string","enum":["ready","degraded","unavailable"]},"data_updated_at":{"type":["string","null"],"format":"date-time"}}},
      "Price":{"type":["object","null"],"properties":{"currency":{"const":"MDL"},"regular":{"type":"string","pattern":"^[0-9]+\\.[0-9]{2}$"},"special":{"type":["string","null"]},"current":{"type":"string"},"mode":{"type":"string","enum":["fixed","contact"]},"tax_included":{"type":"boolean"}}},
      "Product":{"type":"object","required":["product_id","language","name","canonical_url","price","availability","data_stale","images","categories"],"properties":{"product_id":{"type":"integer"},"language":{"enum":["ru","ro"]},"name":{"type":"string"},"description":{"type":"string"},"canonical_url":{"type":"string","format":"uri"},"brand":{"type":"object"},"model":{"type":["string","null"]},"sku":{"type":["string","null"]},"mpn":{"type":["string","null"]},"price":{"$ref":"#/components/schemas/Price"},"availability":{"type":["string","null"],"enum":["in_stock","preorder","backorder","out_of_stock",null]},"data_stale":{"type":"boolean"},"main_image":{"type":["string","null"],"format":"uri"},"images":{"type":"array","maxItems":50,"items":{"type":"string","format":"uri"}},"categories":{"type":"array","items":{"type":"object"}},"attributes":{"type":"array","items":{"type":"object"}},"filters":{"type":"array","items":{"type":"object"}},"family_id":{"type":["integer","null"]},"variant_product_ids":{"type":"array","maxItems":20,"items":{"type":"integer"}},"combo_items":{"type":"array","items":{"type":"object"}},"updated_at":{"type":"string","format":"date-time"}}},
      "ProductPage":{"type":"object","required":["data_updated_at","items","next_cursor","links"],"properties":{"data_updated_at":{"type":"string","format":"date-time"},"items":{"type":"array","maxItems":20,"items":{"$ref":"#/components/schemas/Product"}},"next_cursor":{"type":["string","null"]},"links":{"type":"object"}}},
      "Problem":{"type":"object","required":["type","title","status","code","detail"],"properties":{"type":{"type":"string","format":"uri"},"title":{"type":"string"},"status":{"type":"integer"},"code":{"type":"string"},"detail":{"type":"string"}}}
    },
    "responses": {
      "Problem":{"description":"Request error","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}},
      "Unavailable":{"description":"Projection unavailable","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/Problem"}}}}
    }
  }
}
