{
  "info": {
    "_postman_id": "jokko-crm-api-v1",
    "name": "Jokko CRM API v1",
    "description": "Collection des endpoints principaux Jokko CRM (Sanctum Bearer).\n\n1. Créez un token dans Paramètres → API\n2. Collez-le dans la variable `token`\n3. Renseignez `store_id` (id boutique) pour les écritures\n\nPlan Entreprise (ou essai).",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": {
    "type": "bearer",
    "bearer": [
      {
        "key": "token",
        "value": "{{token}}",
        "type": "string"
      }
    ]
  },
  "variable": [
    { "key": "baseUrl", "value": "http://127.0.0.1:8000/api/v1" },
    { "key": "token", "value": "" },
    { "key": "store_id", "value": "1" }
  ],
  "item": [
    {
      "name": "Auth & contexte",
      "item": [
        {
          "name": "GET me",
          "request": {
            "method": "GET",
            "header": [
              { "key": "Accept", "value": "application/json" },
              { "key": "X-Store-Id", "value": "{{store_id}}" }
            ],
            "url": "{{baseUrl}}/me"
          }
        },
        {
          "name": "GET stores",
          "request": {
            "method": "GET",
            "header": [
              { "key": "Accept", "value": "application/json" }
            ],
            "url": "{{baseUrl}}/stores"
          }
        }
      ]
    },
    {
      "name": "Clients",
      "item": [
        {
          "name": "GET customers",
          "request": {
            "method": "GET",
            "header": [
              { "key": "Accept", "value": "application/json" },
              { "key": "X-Store-Id", "value": "{{store_id}}" }
            ],
            "url": "{{baseUrl}}/customers?per_page=20"
          }
        },
        {
          "name": "POST customer",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Accept", "value": "application/json" },
              { "key": "Content-Type", "value": "application/json" },
              { "key": "X-Store-Id", "value": "{{store_id}}" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"Awa Diop\",\n  \"phone\": \"771234567\",\n  \"email\": \"awa@example.com\",\n  \"tag\": \"hot\"\n}"
            },
            "url": "{{baseUrl}}/customers"
          }
        }
      ]
    },
    {
      "name": "Produits",
      "item": [
        {
          "name": "GET products",
          "request": {
            "method": "GET",
            "header": [
              { "key": "Accept", "value": "application/json" },
              { "key": "X-Store-Id", "value": "{{store_id}}" }
            ],
            "url": "{{baseUrl}}/products"
          }
        },
        {
          "name": "POST product",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Accept", "value": "application/json" },
              { "key": "Content-Type", "value": "application/json" },
              { "key": "X-Store-Id", "value": "{{store_id}}" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"Savon\",\n  \"price\": 500,\n  \"stock\": 20,\n  \"sku\": \"SAV-001\"\n}"
            },
            "url": "{{baseUrl}}/products"
          }
        }
      ]
    },
    {
      "name": "Ventes",
      "item": [
        {
          "name": "GET sales (consolidé)",
          "request": {
            "method": "GET",
            "header": [
              { "key": "Accept", "value": "application/json" },
              { "key": "X-Store-Id", "value": "all" }
            ],
            "url": "{{baseUrl}}/sales?from=2026-07-01"
          }
        },
        {
          "name": "POST sale",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Accept", "value": "application/json" },
              { "key": "Content-Type", "value": "application/json" },
              { "key": "X-Store-Id", "value": "{{store_id}}" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"customer_id\": 1,\n  \"product_id\": 1,\n  \"quantity\": 2,\n  \"unit_price\": 500,\n  \"payment_status\": \"paid\",\n  \"payment_method\": \"cash\"\n}"
            },
            "url": "{{baseUrl}}/sales"
          }
        }
      ]
    },
    {
      "name": "Devis",
      "item": [
        {
          "name": "GET quotes",
          "request": {
            "method": "GET",
            "header": [
              { "key": "Accept", "value": "application/json" },
              { "key": "X-Store-Id", "value": "{{store_id}}" }
            ],
            "url": "{{baseUrl}}/quotes"
          }
        },
        {
          "name": "POST quote",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Accept", "value": "application/json" },
              { "key": "Content-Type", "value": "application/json" },
              { "key": "X-Store-Id", "value": "{{store_id}}" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"customer_id\": 1,\n  \"quote_date\": \"2026-07-23\",\n  \"valid_until\": \"2026-08-07\",\n  \"status\": \"draft\",\n  \"products\": [\n    { \"product_id\": 1, \"quantity\": 1, \"unit_price\": 5000 }\n  ]\n}"
            },
            "url": "{{baseUrl}}/quotes"
          }
        },
        {
          "name": "POST convert quote → sale",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Accept", "value": "application/json" },
              { "key": "X-Store-Id", "value": "{{store_id}}" }
            ],
            "url": "{{baseUrl}}/quotes/1/convert-to-sale"
          }
        }
      ]
    },
    {
      "name": "Rapports",
      "item": [
        {
          "name": "GET reports/summary",
          "request": {
            "method": "GET",
            "header": [
              { "key": "Accept", "value": "application/json" },
              { "key": "X-Store-Id", "value": "all" }
            ],
            "url": "{{baseUrl}}/reports/summary"
          }
        },
        {
          "name": "GET reports/holding",
          "request": {
            "method": "GET",
            "header": [
              { "key": "Accept", "value": "application/json" }
            ],
            "url": "{{baseUrl}}/reports/holding"
          }
        }
      ]
    },
    {
      "name": "Mobile",
      "item": [
        {
          "name": "POST devices",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Accept", "value": "application/json" },
              { "key": "Content-Type", "value": "application/json" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"platform\": \"ios\",\n  \"token\": \"fcm-or-apns-token\",\n  \"device_name\": \"iPhone\",\n  \"app_version\": \"1.0.0\"\n}"
            },
            "url": "{{baseUrl}}/devices"
          }
        }
      ]
    }
  ]
}
