{
    "info": {
        "_postman_id": "enw-auth-user-collection",
        "name": "ENW — Auth & User",
        "description": "AuthController + UserController endpoint'lerini kapsayan tam koleksiyon. Login otomatik token kaydeder.",
        "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
    },
    "variable": [
        {
            "key": "base_url",
            "value": "http://api.extranetwork.com.test",
            "type": "string"
        },
        { "key": "user_token", "value": "", "type": "string" },
        { "key": "language", "value": "en", "type": "string" },
        {
            "key": "admin_email",
            "value": "admin@extranetwork.com",
            "type": "string"
        },
        { "key": "admin_password", "value": "Admin@1234!", "type": "string" }
    ],
    "item": [
        {
            "name": "Auth",
            "item": [
                {
                    "name": "Login",
                    "event": [
                        {
                            "listen": "test",
                            "script": {
                                "type": "text/javascript",
                                "exec": [
                                    "const res = pm.response.json();",
                                    "if (res.status === 1 && res.data && res.data.token) {",
                                    "    pm.collectionVariables.set('user_token', res.data.token);",
                                    "    console.log('Token kaydedildi.');",
                                    "}",
                                    "pm.test('200 OK', () => pm.response.to.have.status(200));"
                                ]
                            }
                        }
                    ],
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            },
                            { "key": "language", "value": "{{language}}" }
                        ],
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"email\": \"{{admin_email}}\",\n    \"password\": \"{{admin_password}}\",\n    \"remember_me\": 0,\n    \"locale\": \"en\",\n    \"onesignal_key\": null\n}"
                        },
                        "url": {
                            "raw": "{{base_url}}/app/v1/auth/login",
                            "host": ["{{base_url}}"],
                            "path": ["app", "v1", "auth", "login"]
                        }
                    }
                },
                {
                    "name": "Refresh Token",
                    "event": [
                        {
                            "listen": "test",
                            "script": {
                                "type": "text/javascript",
                                "exec": [
                                    "const res = pm.response.json();",
                                    "if (res.status === 1 && res.data && res.data.token) {",
                                    "    pm.collectionVariables.set('user_token', res.data.token);",
                                    "}"
                                ]
                            }
                        }
                    ],
                    "request": {
                        "method": "GET",
                        "header": [
                            { "key": "authToken", "value": "{{user_token}}" },
                            { "key": "language", "value": "{{language}}" }
                        ],
                        "url": {
                            "raw": "{{base_url}}/app/v1/auth/refresh-token",
                            "host": ["{{base_url}}"],
                            "path": ["app", "v1", "auth", "refresh-token"]
                        }
                    }
                },
                {
                    "name": "Logout",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            },
                            { "key": "authToken", "value": "{{user_token}}" },
                            { "key": "language", "value": "{{language}}" }
                        ],
                        "body": { "mode": "raw", "raw": "{}" },
                        "url": {
                            "raw": "{{base_url}}/app/v1/logout",
                            "host": ["{{base_url}}"],
                            "path": ["app", "v1", "logout"]
                        }
                    }
                }
            ]
        },
        {
            "name": "User — Public (no auth)",
            "item": [
                {
                    "name": "Register",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            },
                            { "key": "language", "value": "{{language}}" }
                        ],
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"params\": {\n        \"name\": \"John\",\n        \"surname\": \"Doe\",\n        \"email\": \"john@example.com\",\n        \"password\": \"Secret@123\",\n        \"password_confirmation\": \"Secret@123\",\n        \"phone\": \"+905555555555\",\n        \"gender\": \"M\",\n        \"language\": \"en\",\n        \"temp_hotel_id\": null\n    }\n}"
                        },
                        "url": {
                            "raw": "{{base_url}}/app/v1/user/register",
                            "host": ["{{base_url}}"],
                            "path": ["app", "v1", "user", "register"]
                        }
                    }
                },
                {
                    "name": "Register With Property",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            },
                            { "key": "language", "value": "{{language}}" }
                        ],
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"params\": {\n        \"name\": \"Jane\",\n        \"surname\": \"Manager\",\n        \"email\": \"jane@example.com\",\n        \"password\": \"Secret@123\",\n        \"password_confirmation\": \"Secret@123\",\n        \"phone\": \"+905555555556\",\n        \"gender\": \"F\",\n        \"language\": \"en\",\n        \"property_name\": \"Demo Hotel\",\n        \"web\": \"www.demo-hotel.com\"\n    }\n}"
                        },
                        "url": {
                            "raw": "{{base_url}}/app/v1/user/register-user-with-property",
                            "host": ["{{base_url}}"],
                            "path": [
                                "app",
                                "v1",
                                "user",
                                "register-user-with-property"
                            ]
                        }
                    }
                },
                {
                    "name": "Check Key (activation/reset link)",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            },
                            { "key": "language", "value": "{{language}}" }
                        ],
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"params\": {\n        \"email\": \"john@example.com\",\n        \"key\": \"HASH_KEY_FROM_EMAIL\"\n    }\n}"
                        },
                        "url": {
                            "raw": "{{base_url}}/app/v1/user/check-key",
                            "host": ["{{base_url}}"],
                            "path": ["app", "v1", "user", "check-key"]
                        }
                    }
                },
                {
                    "name": "New Password (after activation)",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            },
                            { "key": "language", "value": "{{language}}" }
                        ],
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"params\": {\n        \"email\": \"john@example.com\",\n        \"key\": \"HASH_KEY_FROM_EMAIL\",\n        \"password\": \"NewSecret@123\",\n        \"password_confirmation\": \"NewSecret@123\"\n    }\n}"
                        },
                        "url": {
                            "raw": "{{base_url}}/app/v1/user/new-password",
                            "host": ["{{base_url}}"],
                            "path": ["app", "v1", "user", "new-password"]
                        }
                    }
                },
                {
                    "name": "Forgot Password",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            },
                            { "key": "language", "value": "{{language}}" }
                        ],
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"params\": {\n        \"email\": \"john@example.com\"\n    }\n}"
                        },
                        "url": {
                            "raw": "{{base_url}}/app/v1/user/forgot-password",
                            "host": ["{{base_url}}"],
                            "path": ["app", "v1", "user", "forgot-password"]
                        }
                    }
                },
                {
                    "name": "Reset Password",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            },
                            { "key": "language", "value": "{{language}}" }
                        ],
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"params\": {\n        \"email\": \"john@example.com\",\n        \"key\": \"HASH_KEY_FROM_EMAIL\",\n        \"password\": \"NewSecret@123\",\n        \"password_confirmation\": \"NewSecret@123\"\n    }\n}"
                        },
                        "url": {
                            "raw": "{{base_url}}/app/v1/user/reset-password",
                            "host": ["{{base_url}}"],
                            "path": ["app", "v1", "user", "reset-password"]
                        }
                    }
                }
            ]
        },
        {
            "name": "User — Protected (jwt.auth)",
            "auth": {
                "type": "noauth"
            },
            "item": [
                {
                    "name": "Get User List",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            },
                            { "key": "authToken", "value": "{{user_token}}" },
                            { "key": "language", "value": "{{language}}" }
                        ],
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"params\": {\n        \"criteria\": [],\n        \"select\": [\"id\", \"name\", \"surname\", \"email\", \"status\", \"user_type\"],\n        \"orderBy\": [{ \"field\": \"id\", \"value\": \"DESC\" }],\n        \"skip\": 0,\n        \"take\": 50\n    }\n}"
                        },
                        "url": {
                            "raw": "{{base_url}}/app/v1/user",
                            "host": ["{{base_url}}"],
                            "path": ["app", "v1", "user"]
                        }
                    }
                },
                {
                    "name": "Create User",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            },
                            { "key": "authToken", "value": "{{user_token}}" },
                            { "key": "language", "value": "{{language}}" }
                        ],
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"params\": {\n        \"name\": \"Mark\",\n        \"surname\": \"Staff\",\n        \"email\": \"mark@example.com\",\n        \"password\": \"Secret@123\",\n        \"password_confirmation\": \"Secret@123\",\n        \"phone\": \"+905555555557\",\n        \"gender\": \"M\",\n        \"language\": \"en\",\n        \"user_type\": 0,\n        \"status\": 1\n    }\n}"
                        },
                        "url": {
                            "raw": "{{base_url}}/app/v1/user/create",
                            "host": ["{{base_url}}"],
                            "path": ["app", "v1", "user", "create"]
                        }
                    }
                },
                {
                    "name": "Update User",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            },
                            { "key": "authToken", "value": "{{user_token}}" },
                            { "key": "language", "value": "{{language}}" }
                        ],
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"params\": {\n        \"update_user_id\": 2,\n        \"user_update_data\": {\n            \"name\": \"Updated\",\n            \"surname\": \"Name\",\n            \"phone\": \"+905555555558\",\n            \"language\": \"tr\",\n            \"status\": 1\n        }\n    }\n}"
                        },
                        "url": {
                            "raw": "{{base_url}}/app/v1/user/update",
                            "host": ["{{base_url}}"],
                            "path": ["app", "v1", "user", "update"]
                        }
                    }
                },
                {
                    "name": "Change Password",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            },
                            { "key": "authToken", "value": "{{user_token}}" },
                            { "key": "language", "value": "{{language}}" }
                        ],
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"params\": {\n        \"old_password\": \"Admin@1234!\",\n        \"password\": \"NewSecret@123\",\n        \"password_confirmation\": \"NewSecret@123\"\n    }\n}"
                        },
                        "url": {
                            "raw": "{{base_url}}/app/v1/user/change-password",
                            "host": ["{{base_url}}"],
                            "path": ["app", "v1", "user", "change-password"]
                        }
                    }
                },
                {
                    "name": "Add User-Property Mapping",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            },
                            { "key": "authToken", "value": "{{user_token}}" },
                            { "key": "language", "value": "{{language}}" }
                        ],
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"params\": {\n        \"add_user_id\": 2,\n        \"add_property_id\": [1, 2]\n    }\n}"
                        },
                        "url": {
                            "raw": "{{base_url}}/app/v1/user/add-user-property",
                            "host": ["{{base_url}}"],
                            "path": ["app", "v1", "user", "add-user-property"]
                        }
                    }
                },
                {
                    "name": "Remove User-Property Mapping",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            },
                            { "key": "authToken", "value": "{{user_token}}" },
                            { "key": "language", "value": "{{language}}" }
                        ],
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"params\": {\n        \"remove_user_id\": 2,\n        \"remove_property_id\": [1]\n    }\n}"
                        },
                        "url": {
                            "raw": "{{base_url}}/app/v1/user/remove-user-property",
                            "host": ["{{base_url}}"],
                            "path": [
                                "app",
                                "v1",
                                "user",
                                "remove-user-property"
                            ]
                        }
                    }
                },
                {
                    "name": "Get Profile",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            },
                            { "key": "authToken", "value": "{{user_token}}" },
                            { "key": "language", "value": "{{language}}" }
                        ],
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"params\": {}\n}"
                        },
                        "url": {
                            "raw": "{{base_url}}/app/v1/user/profile/get",
                            "host": ["{{base_url}}"],
                            "path": ["app", "v1", "user", "profile", "get"]
                        }
                    }
                },
                {
                    "name": "Update Profile",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            },
                            { "key": "authToken", "value": "{{user_token}}" },
                            { "key": "language", "value": "{{language}}" }
                        ],
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"params\": {\n        \"name\": \"Admin\",\n        \"surname\": \"User\",\n        \"gender\": \"M\",\n        \"language\": \"tr\",\n        \"phone\": \"+905555555555\"\n    }\n}"
                        },
                        "url": {
                            "raw": "{{base_url}}/app/v1/user/profile/update",
                            "host": ["{{base_url}}"],
                            "path": ["app", "v1", "user", "profile", "update"]
                        }
                    }
                },
                {
                    "name": "Set Active Property (requires property middleware)",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            },
                            { "key": "authToken", "value": "{{user_token}}" },
                            { "key": "language", "value": "{{language}}" }
                        ],
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"params\": {\n        \"property_id\": 1\n    }\n}"
                        },
                        "url": {
                            "raw": "{{base_url}}/app/v1/user/set-user-property",
                            "host": ["{{base_url}}"],
                            "path": ["app", "v1", "user", "set-user-property"]
                        }
                    }
                }
            ]
        }
    ]
}
