{
    "info": {
        "_postman_id": "auth-login-collection",
        "name": "ENW — Auth",
        "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
    },
    "variable": [
        {
            "key": "base_url",
            "value": "http://api.extranetwork.local",
            "type": "string"
        },
        {
            "key": "user_token",
            "value": "",
            "type": "string"
        }
    ],
    "item": [
        {
            "name": "Login",
            "event": [
                {
                    "listen": "test",
                    "script": {
                        "exec": [
                            "var res = pm.response.json();",
                            "if (res.status === 1 && res.data && res.data.token) {",
                            "    pm.collectionVariables.set('user_token', res.data.token);",
                            "    pm.test('Login başarılı, token kaydedildi', function () {",
                            "        pm.response.to.have.status(200);",
                            "    });",
                            "} else {",
                            "    pm.test('Login başarısız', function () { pm.expect.fail(JSON.stringify(res)); });",
                            "}"
                        ],
                        "type": "text/javascript"
                    }
                }
            ],
            "request": {
                "method": "POST",
                "header": [
                    {
                        "key": "Content-Type",
                        "value": "application/json"
                    }
                ],
                "body": {
                    "mode": "raw",
                    "raw": "{\n    \"email\": \"admin@extranetwork.com\",\n    \"password\": \"Admin@1234!\",\n    \"remember_me\": 0\n}"
                },
                "url": {
                    "raw": "{{base_url}}/app/v1/auth/login",
                    "host": ["{{base_url}}"],
                    "path": ["app", "v1", "auth", "login"]
                }
            },
            "response": []
        },
        {
            "name": "Refresh Token",
            "request": {
                "method": "POST",
                "header": [
                    {
                        "key": "Content-Type",
                        "value": "application/json"
                    },
                    {
                        "key": "authToken",
                        "value": "{{user_token}}"
                    }
                ],
                "body": {
                    "mode": "raw",
                    "raw": "{}"
                },
                "url": {
                    "raw": "{{base_url}}/app/v1/auth/refresh-token",
                    "host": ["{{base_url}}"],
                    "path": ["app", "v1", "auth", "refresh-token"]
                }
            },
            "response": []
        },
        {
            "name": "Logout",
            "request": {
                "method": "POST",
                "header": [
                    {
                        "key": "Content-Type",
                        "value": "application/json"
                    },
                    {
                        "key": "authToken",
                        "value": "{{user_token}}"
                    }
                ],
                "body": {
                    "mode": "raw",
                    "raw": "{}"
                },
                "url": {
                    "raw": "{{base_url}}/app/v1/logout",
                    "host": ["{{base_url}}"],
                    "path": ["app", "v1", "logout"]
                }
            },
            "response": []
        }
    ]
}
