{
  "info": {
    "name": "Farm Data",
    "description": "API داده‌های farm: ایجاد/آپدیت رکورد farm و مدیریت پارامترهای سنسور",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    {"key": "baseUrl", "value": "http://localhost:8020"},
    {"key": "farm_uuid", "value": "00000000-0000-0000-0000-000000000000"}
  ],
  "item": [
    {
      "name": "Upsert Farm Data (POST)",
      "request": {
        "method": "POST",
        "header": [
          {"key": "Content-Type", "value": "application/json"},
          {"key": "Accept", "value": "application/json"}
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"farm_uuid\": \"{{farm_uuid}}\",\n  \"farm_boundary\": {\n    \"corners\": [\n      {\"lat\": 35.7000, \"lon\": 51.3900},\n      {\"lat\": 35.7000, \"lon\": 51.4100},\n      {\"lat\": 35.7200, \"lon\": 51.4100},\n      {\"lat\": 35.7200, \"lon\": 51.3900}\n    ]\n  },\n  \"sensor_payload\": {\n    \"sensor-7-1\": {\n      \"soil_moisture\": 25.5,\n      \"soil_temperature\": 22.3,\n      \"soil_ph\": 7.2,\n      \"electrical_conductivity\": 1.8,\n      \"nitrogen\": 120.0,\n      \"phosphorus\": 45.0,\n      \"potassium\": 180.0\n    }\n  }\n}"
        },
        "url": {
          "raw": "{{baseUrl}}/api/farm-data/",
          "host": ["{{baseUrl}}"],
          "path": ["api", "farm-data", ""]
        }
      },
      "description": "ایجاد یا آپدیت داده farm. مختصات گوشه‌های زمین را می‌گیرد، مرکز را خودش محاسبه می‌کند، location را می‌سازد و weather را از همان location پیدا می‌کند."
    },
    {
      "name": "Add Parameter",
      "request": {
        "method": "POST",
        "header": [
          {"key": "Content-Type", "value": "application/json"},
          {"key": "Accept", "value": "application/json"}
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"sensor_key\": \"sensor-7-1\",\n  \"code\": \"soil_moisture\",\n  \"name_fa\": \"رطوبت خاک\",\n  \"unit\": \"%\",\n  \"data_type\": \"float\",\n  \"metadata\": {\n    \"min\": 0,\n    \"max\": 100\n  }\n}"
        },
        "url": {
          "raw": "{{baseUrl}}/api/farm-data/parameters/",
          "host": ["{{baseUrl}}"],
          "path": ["api", "farm-data", "parameters", ""]
        }
      },
      "description": "اضافه کردن یا ویرایش پارامتر جدید. در ParameterUpdateLog ثبت می‌شود."
    }
  ]
}
