{
  "info": {
    "_postman_id": "9d74101d-f788-4dbf-83b3-11c8f9789b73",
    "name": "Smoke Tracker",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
    "_exporter_id": "smoke-tracker"
  },
  "item": [
    {
      "name": "Auth • Signup",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "name": "Content-Type",
            "value": "application/json",
            "type": "text"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"login\": \"smoker-demo\",\n  \"password\": \"secret123\"\n}"
        },
        "url": {
          "raw": "{{baseUrl}}/smoke-tracker/auth/signup",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "smoke-tracker",
            "auth",
            "signup"
          ]
        },
        "description": "Регистрация нового пользователя. Повторный вызов с тем же логином вернёт ошибку."
      },
      "response": []
    },
    {
      "name": "Auth • Signin",
      "event": [
        {
          "listen": "test",
          "script": {
            "type": "text/javascript",
            "exec": [
              "const json = pm.response.json();",
              "if (json && json.body && json.body.token) {",
              "    pm.environment.set('smokeToken', json.body.token);",
              "}"
            ]
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "name": "Content-Type",
            "value": "application/json",
            "type": "text"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"login\": \"smoker-demo\",\n  \"password\": \"secret123\"\n}"
        },
        "url": {
          "raw": "{{baseUrl}}/smoke-tracker/auth/signin",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "smoke-tracker",
            "auth",
            "signin"
          ]
        },
        "description": "Авторизация пользователя. Скрипт тестов сохранит JWT в переменную окружения smokeToken."
      },
      "response": []
    },
    {
      "name": "Cigarettes • Log entry",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "name": "Content-Type",
            "value": "application/json",
            "type": "text"
          },
          {
            "key": "Authorization",
            "name": "Authorization",
            "value": "Bearer {{smokeToken}}",
            "type": "text"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n  \"smokedAt\": \"2025-01-01T09:30:00.000Z\",\n  \"note\": \"Первая сигарета за день\"\n}"
        },
        "url": {
          "raw": "{{baseUrl}}/smoke-tracker/cigarettes",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "smoke-tracker",
            "cigarettes"
          ]
        },
        "description": "Создать запись о выкуренной сигарете. Если smokedAt не указан, сервер использует текущее время."
      },
      "response": []
    },
    {
      "name": "Cigarettes • List",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "name": "Authorization",
            "value": "Bearer {{smokeToken}}",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/smoke-tracker/cigarettes?from=2025-01-01T00:00:00.000Z&to=2025-01-07T23:59:59.999Z",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "smoke-tracker",
            "cigarettes"
          ],
          "query": [
            {
              "key": "from",
              "value": "2025-01-01T00:00:00.000Z"
            },
            {
              "key": "to",
              "value": "2025-01-07T23:59:59.999Z"
            }
          ]
        },
        "description": "Список сигарет текущего пользователя. Параметры from/to необязательны."
      },
      "response": []
    },
    {
      "name": "Stats • Daily",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "name": "Authorization",
            "value": "Bearer {{smokeToken}}",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/smoke-tracker/stats/daily?from=2025-01-01&to=2025-01-31",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "smoke-tracker",
            "stats",
            "daily"
          ],
          "query": [
            {
              "key": "from",
              "value": "2025-01-01"
            },
            {
              "key": "to",
              "value": "2025-01-31"
            }
          ]
        },
        "description": "Агрегация по дням для графиков. Если from/to не заданы, используется последний месяц."
      },
      "response": []
    },
    {
      "name": "Stats • Summary",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "name": "Authorization",
            "value": "Bearer {{smokeToken}}",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/smoke-tracker/stats/summary?from=2025-01-01T00:00:00.000Z&to=2025-01-31T23:59:59.999Z",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "smoke-tracker",
            "stats",
            "summary"
          ],
          "query": [
            {
              "key": "from",
              "value": "2025-01-01T00:00:00.000Z"
            },
            {
              "key": "to",
              "value": "2025-01-31T23:59:59.999Z"
            }
          ]
        },
        "description": "Расширенная статистика: среднее в день, статистика по дням недели, сравнение с общими показателями всех пользователей."
      },
      "response": []
    }
  ],
  "event": [],
  "variable": [
    {
      "key": "baseUrl",
      "value": "http://localhost:8044"
    },
    {
      "key": "smokeToken",
      "value": ""
    }
  ]
}

