{
  "info": {
    "name":   "CampNow - Availability Rules",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    { "key": "baseUrl",       "value": "http://localhost:3000/api", "type": "string" },
    { "key": "campsiteToken", "value": "<JWT_TOKEN>",               "type": "string" },
    { "key": "campsiteId",    "value": "<CAMPSITE_ID>",             "type": "string" }
  ],
  "item": [
    {
      "name": "Get Availability Grid (Authenticated)",
      "request": {
        "method": "GET",
        "header": [
          { "key": "Authorization", "value": "Bearer {{campsiteToken}}" }
        ],
        "url": {
          "raw":   "{{baseUrl}}/availability?fromDate=2025-06-01&toDate=2025-06-07",
          "host":  ["{{baseUrl}}"],
          "path":  ["availability"],
          "query": [
            { "key": "fromDate", "value": "2025-06-01" },
            { "key": "toDate",   "value": "2025-06-07" }
          ]
        }
      }
    },
    {
      "name": "Get Availability Grid (Public)",
      "request": {
        "method": "GET",
        "header": [],
        "url": {
          "raw":   "{{baseUrl}}/availability?campsiteId={{campsiteId}}&fromDate=2025-06-01&toDate=2025-06-07",
          "host":  ["{{baseUrl}}"],
          "path":  ["availability"],
          "query": [
            { "key": "campsiteId", "value": "{{campsiteId}}" },
            { "key": "fromDate",   "value": "2025-06-01" },
            { "key": "toDate",     "value": "2025-06-07" }
          ]
        }
      }
    },
    {
      "name": "Get Availability Rules (Management UI)",
      "request": {
        "method": "GET",
        "header": [
          { "key": "Authorization", "value": "Bearer {{campsiteToken}}" }
        ],
        "url": {
          "raw":   "{{baseUrl}}/campground/{{campsiteId}}/availability/rules?startDate=2025-06-01&endDate=2025-06-07",
          "host":  ["{{baseUrl}}"],
          "path":  ["campground", "{{campsiteId}}", "availability", "rules"],
          "query": [
            { "key": "startDate", "value": "2025-06-01" },
            { "key": "endDate",   "value": "2025-06-07" }
          ]
        }
      }
    },
    {
      "name": "Save Availability Rules - Date Range",
      "request": {
        "method": "PUT",
        "header": [
          { "key": "Authorization", "value": "Bearer {{campsiteToken}}" },
          { "key": "Content-Type",  "value": "application/json" }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"startDate\": \"2025-06-01\",\n  \"endDate\": \"2025-06-07\",\n  \"untilFurtherNotice\": false,\n  \"categories\": [\n    {\n      \"categoryId\": \"<SUB_CATEGORY_ID>\",\n      \"isVisible\": true,\n      \"status\": \"available\"\n    },\n    {\n      \"categoryId\": \"<SUB_CATEGORY_ID_2>\",\n      \"isVisible\": false,\n      \"status\": \"not_available\"\n    }\n  ]\n}"
        },
        "url": {
          "raw":  "{{baseUrl}}/campground/{{campsiteId}}/availability/rules",
          "host": ["{{baseUrl}}"],
          "path": ["campground", "{{campsiteId}}", "availability", "rules"]
        }
      }
    },
    {
      "name": "Save Availability Rules - Until Further Notice",
      "request": {
        "method": "PUT",
        "header": [
          { "key": "Authorization", "value": "Bearer {{campsiteToken}}" },
          { "key": "Content-Type",  "value": "application/json" }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"startDate\": \"2025-06-01\",\n  \"untilFurtherNotice\": true,\n  \"categories\": [\n    {\n      \"categoryId\": \"<SUB_CATEGORY_ID>\",\n      \"isVisible\": true,\n      \"status\": \"limited\"\n    }\n  ]\n}"
        },
        "url": {
          "raw":  "{{baseUrl}}/campground/{{campsiteId}}/availability/rules",
          "host": ["{{baseUrl}}"],
          "path": ["campground", "{{campsiteId}}", "availability", "rules"]
        }
      }
    }
  ]
}
