{
  "info": {
    "name": "Wave 2 TED Structured Search Extended",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
    "description": "NEW runtime TED structured search with projection-aware filters, hybrid ranking, and facets."
  },
  "variable": [
    { "key": "baseUrl", "value": "http://localhost:8080/api" }
  ],
  "item": [
    {
      "name": "Structured only - GET",
      "request": {
        "method": "GET",
        "url": {
          "raw": "{{baseUrl}}/v1/documents/search?countryCode=AUT&noticeType=CONTRACT_NOTICE&includeFacets=true&page=0&size=20&sortBy=publicationDate&sortDirection=desc",
          "host": ["{{baseUrl}}"],
          "path": ["v1", "documents", "search"],
          "query": [
            { "key": "countryCode", "value": "AUT" },
            { "key": "noticeType", "value": "CONTRACT_NOTICE" },
            { "key": "includeFacets", "value": "true" },
            { "key": "page", "value": "0" },
            { "key": "size", "value": "20" },
            { "key": "sortBy", "value": "publicationDate" },
            { "key": "sortDirection", "value": "desc" }
          ]
        }
      },
      "event": [{
        "listen": "test",
        "script": {
          "exec": [
            "pm.test('status 200', function () { pm.response.to.have.status(200); });",
            "const json = pm.response.json();",
            "pm.test('documents array exists', function () { pm.expect(json.documents).to.be.an('array'); });",
            "pm.test('facets object exists', function () { pm.expect(json.facets).to.be.an('object'); });"
          ]
        }
      }]
    },
    {
      "name": "Hybrid ranked TED search - GET",
      "request": {
        "method": "GET",
        "url": {
          "raw": "{{baseUrl}}/v1/documents/search?countryCode=DEU&cpvPrefix=33&q=medical imaging systems&similarityThreshold=0.65&includeFacets=true",
          "host": ["{{baseUrl}}"],
          "path": ["v1", "documents", "search"],
          "query": [
            { "key": "countryCode", "value": "DEU" },
            { "key": "cpvPrefix", "value": "33" },
            { "key": "q", "value": "medical imaging systems" },
            { "key": "similarityThreshold", "value": "0.65" },
            { "key": "includeFacets", "value": "true" }
          ]
        }
      },
      "event": [{
        "listen": "test",
        "script": {
          "exec": [
            "pm.test('status 200', function () { pm.response.to.have.status(200); });",
            "const json = pm.response.json();",
            "pm.test('documents array exists', function () { pm.expect(json.documents).to.be.an('array'); });"
          ]
        }
      }]
    },
    {
      "name": "Structured only - POST with facets",
      "request": {
        "method": "POST",
        "header": [{ "key": "Content-Type", "value": "application/json" }],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"countryCodes\": [\"AUT\", \"DEU\"],\n  \"noticeType\": \"CONTRACT_NOTICE\",\n  \"contractNature\": \"SUPPLIES\",\n  \"procedureType\": \"OPEN\",\n  \"publicationDateFrom\": \"2026-01-01\",\n  \"publicationDateTo\": \"2026-12-31\",\n  \"includeFacets\": true,\n  \"facetBucketLimit\": 10,\n  \"page\": 0,\n  \"size\": 20,\n  \"sortBy\": \"publicationDate\",\n  \"sortDirection\": \"desc\"\n}"
        },
        "url": {
          "raw": "{{baseUrl}}/v1/documents/search",
          "host": ["{{baseUrl}}"],
          "path": ["v1", "documents", "search"]
        }
      }
    },
    {
      "name": "Parity-style request for shared legacy filters",
      "request": {
        "method": "POST",
        "header": [{ "key": "Content-Type", "value": "application/json" }],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"countryCode\": \"AUT\",\n  \"noticeType\": \"CONTRACT_NOTICE\",\n  \"contractNature\": \"SERVICES\",\n  \"procedureType\": \"OPEN\",\n  \"projectTitleContains\": \"maintenance\",\n  \"publicationDateFrom\": \"2026-04-01\",\n  \"publicationDateTo\": \"2026-04-30\",\n  \"page\": 0,\n  \"size\": 20,\n  \"sortBy\": \"publicationDate\",\n  \"sortDirection\": \"desc\"\n}"
        },
        "url": {
          "raw": "{{baseUrl}}/v1/documents/search",
          "host": ["{{baseUrl}}"],
          "path": ["v1", "documents", "search"]
        }
      }
    }
  ]
}
