{
	"info": {
		"_postman_id": "04615124-68a9-41d5-bea9-03d58e868e6b",
		"name": "Catalog Categories",
		"description": "Complete Catalog Categories API Collection with all 9 endpoints",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
		"_exporter_id": "50681087",
		"_collection_link": "https://speeding-station-761692.postman.co/workspace/749708e5-00c2-41b9-8163-eb8de19b77f2/collection/50681087-04615124-68a9-41d5-bea9-03d58e868e6b?action=share&source=collection_link&creator=50681087"
	},
	"item": [
		{
			"name": "List Categories",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							"pm.test('Status code is 200', function() {",
							"    pm.response.to.have.status(200);",
							"});",
							"",
							"pm.test('Response has pagination info', function() {",
							"    var jsonData = pm.response.json();",
							"    pm.expect(jsonData.pagination).to.exist;",
							"    pm.expect(jsonData.pagination.total).to.exist;",
							"    pm.expect(jsonData.pagination.per_page).to.exist;",
							"});"
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "GET",
				"header": [
					{
						"key": "Authorization",
						"value": "Bearer {{access_token}}",
						"type": "text"
					},
					{
						"key": "Accept",
						"value": "application/json",
						"type": "text"
					}
				],
				"url": {
					"raw": "{{BASE_URL}}/catalog/categories?page=1&per_page=15&sort_by=created_at&order=desc",
					"host": [
						"{{BASE_URL}}"
					],
					"path": [
						"catalog",
						"categories"
					],
					"query": [
						{
							"key": "page",
							"value": "1",
							"description": "Page number for pagination (default: 1)"
						},
						{
							"key": "per_page",
							"value": "15",
							"description": "Items per page (default: 15, max: 100)"
						},
						{
							"key": "sort_by",
							"value": "created_at",
							"description": "Field to sort by: name, code, slug, created_at"
						},
						{
							"key": "order",
							"value": "desc",
							"description": "Sort order: asc or desc"
						},
						{
							"key": "search",
							"value": "",
							"description": "Search in name, code, slug fields",
							"disabled": true
						},
						{
							"key": "is_active",
							"value": "true",
							"description": "Filter by active status (true/false)",
							"disabled": true
						},
						{
							"key": "parent_id",
							"value": "",
							"description": "Filter by parent category ID",
							"disabled": true
						}
					]
				},
				"description": "**Endpoint:** GET /\n**Route Name:** catalog-categories.index\n**Permission:** view-category\n**Status:** 200 OK\n\n**Description:** Retrieve all categories with pagination, filtering, and sorting support.\n\n**Query Parameters:**\n- page: Page number (default: 1)\n- per_page: Items per page (default: 15, max: 100)\n- sort_by: Sort field (name, code, slug, created_at)\n- order: Sort order (asc, desc)\n- search: Search text\n- is_active: Filter by active status\n- parent_id: Filter by parent category\n\n**Response (200):**\n```json\n{\n  \"success\": true,\n  \"message\": \"Categories retrieved successfully\",\n  \"data\": [...],\n  \"pagination\": {\n    \"total\": 10,\n    \"per_page\": 15,\n    \"current_page\": 1,\n    \"last_page\": 1\n  }\n}\n```"
			},
			"response": []
		},
		{
			"name": "Get Category Tree",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							"pm.test('Status code is 200', function() {",
							"    pm.response.to.have.status(200);",
							"});",
							"",
							"pm.test('Response has hierarchical structure', function() {",
							"    var jsonData = pm.response.json();",
							"    pm.expect(jsonData.data).to.be.an('array');",
							"    pm.expect(jsonData.success).to.equal(true);",
							"});"
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "GET",
				"header": [
					{
						"key": "Authorization",
						"value": "Bearer {{access_token}}",
						"type": "text"
					},
					{
						"key": "Accept",
						"value": "application/json",
						"type": "text"
					}
				],
				"url": {
					"raw": "{{BASE_URL}}/catalog/categories/tree",
					"host": [
						"{{BASE_URL}}"
					],
					"path": [
						"catalog",
						"categories",
						"tree"
					]
				},
				"description": "**Endpoint:** GET /tree\n**Route Name:** catalog-categories.tree\n**Permission:** view-category\n**Status:** 200 OK\n\n**Description:** Retrieve all categories in hierarchical tree structure with parent-child relationships.\n\n**Response (200):**\n```json\n{\n  \"success\": true,\n  \"message\": \"Category tree retrieved successfully\",\n  \"data\": [\n    {\n      \"id\": 1,\n      \"name\": { \"en\": \"Electronics\", \"ar\": \"الإلكترونيات\" },\n      \"slug\": \"electronics\",\n      \"code\": \"ELEC-001\",\n      \"children\": [\n        {\n          \"id\": 2,\n          \"name\": { \"en\": \"Computers\" },\n          \"children\": []\n        }\n      ]\n    }\n  ]\n}\n```"
			},
			"response": []
		},
		{
			"name": "Get Single Category",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							"pm.test('Status code is 200', function() {",
							"    pm.response.to.have.status(200);",
							"});",
							"",
							"pm.test('Response has category data', function() {",
							"    var jsonData = pm.response.json();",
							"    pm.expect(jsonData.data).to.exist;",
							"    pm.expect(jsonData.data.id).to.exist;",
							"    pm.expect(jsonData.data.name).to.exist;",
							"});"
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "GET",
				"header": [
					{
						"key": "Authorization",
						"value": "Bearer {{access_token}}",
						"type": "text"
					},
					{
						"key": "Accept",
						"value": "application/json",
						"type": "text"
					}
				],
				"url": {
					"raw": "{{BASE_URL}}/catalog/categories/1",
					"host": [
						"{{BASE_URL}}"
					],
					"path": [
						"catalog",
						"categories",
						"1"
					]
				},
				"description": "**Endpoint:** GET /{id}\n**Route Name:** catalog-categories.show\n**Permission:** view-category\n**Status:** 200 OK / 404 Not Found\n\n**Description:** Retrieve detailed information for a single category by ID.\n\n**URL Parameters:**\n- id (integer, required): Category ID\n\n**Response (200):**\n```json\n{\n  \"success\": true,\n  \"message\": \"Category retrieved successfully\",\n  \"data\": {\n    \"id\": 1,\n    \"name\": { \"en\": \"Electronics\", \"ar\": \"الإلكترونيات\" },\n    \"slug\": \"electronics\",\n    \"code\": \"ELEC-001\",\n    \"parent_id\": null,\n    \"description\": { \"en\": \"Electronic devices\" },\n    \"meta\": { \"icon\": \"laptop\" },\n    \"is_active\": true,\n    \"created_by\": 1,\n    \"created_at\": \"2025-12-19T10:30:00Z\"\n  }\n}\n```"
			},
			"response": []
		},
		{
			"name": "Get Category Children",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							"pm.test('Status code is 200', function() {",
							"    pm.response.to.have.status(200);",
							"});",
							"",
							"pm.test('Response is array', function() {",
							"    var jsonData = pm.response.json();",
							"    pm.expect(jsonData.data).to.be.an('array');",
							"});"
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "GET",
				"header": [
					{
						"key": "Authorization",
						"value": "Bearer {{access_token}}",
						"type": "text"
					},
					{
						"key": "Accept",
						"value": "application/json",
						"type": "text"
					}
				],
				"url": {
					"raw": "{{BASE_URL}}/catalog/categories/1/children?sort_by=name&order=asc",
					"host": [
						"{{BASE_URL}}"
					],
					"path": [
						"catalog",
						"categories",
						"1",
						"children"
					],
					"query": [
						{
							"key": "sort_by",
							"value": "name",
							"description": "Sort by: name, code, created_at"
						},
						{
							"key": "order",
							"value": "asc",
							"description": "Sort order: asc or desc"
						}
					]
				},
				"description": "**Endpoint:** GET /{id}/children\n**Route Name:** catalog-categories.children\n**Permission:** view-category\n**Status:** 200 OK\n\n**Description:** Retrieve all subcategories (direct children) of a specific category.\n\n**URL Parameters:**\n- id (integer, required): Parent category ID\n\n**Query Parameters:**\n- sort_by: Sort field (name, code, created_at)\n- order: Sort order (asc, desc)\n\n**Response (200):**\n```json\n{\n  \"success\": true,\n  \"message\": \"Category children retrieved successfully\",\n  \"data\": [\n    {\n      \"id\": 2,\n      \"name\": { \"en\": \"Computers\", \"ar\": \"الحواسيب\" },\n      \"slug\": \"computers\",\n      \"code\": \"COMP-001\",\n      \"parent_id\": 1,\n      \"is_active\": true,\n      \"created_at\": \"2025-12-19T10:35:00Z\"\n    }\n  ]\n}\n```"
			},
			"response": []
		},
		{
			"name": "Create Category",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							"pm.test('Status code is 201', function() {",
							"    pm.response.to.have.status(201);",
							"});",
							"",
							"pm.test('Response has created category data', function() {",
							"    var jsonData = pm.response.json();",
							"    pm.expect(jsonData.success).to.equal(true);",
							"    pm.expect(jsonData.data.id).to.exist;",
							"});"
						],
						"type": "text/javascript",
						"packages": {},
						"requests": {}
					}
				}
			],
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Authorization",
						"value": "Bearer {{access_token}}",
						"type": "text"
					},
					{
						"key": "Content-Type",
						"value": "application/json",
						"type": "text"
					},
					{
						"key": "Accept",
						"value": "application/json",
						"type": "text"
					}
				],
				"body": {
					"mode": "raw",
					"raw": "{\n  \"name\": {\n    \"en\": \"Electronics\",\n    \"ar\": \"الإلكترونيات\",\n    \"tr\": \"Elektronik\",\n    \"ur\": \"الیکٹرانکس\"\n  },\n  \"slug\": \"electronics3252\",\n  \"code\": \"ELEC-001\",\n  \"parent_id\": null,\n  \"description\": {\n    \"en\": \"Electronic devices and gadgets\",\n    \"ar\": \"الأجهزة والأدوات الإلكترونية\",\n    \"tr\": \"Elektronik cihazlar ve aksesuarlar\",\n    \"ur\": \"الیکٹرانک ڈیوائسز اور سازو سامان\"\n  },\n  \"meta\": {\n    \"icon\": \"laptop\",\n    \"color\": \"#FF5722\",\n    \"order\": 1\n  },\n  \"is_active\": true\n}"
				},
				"url": {
					"raw": "{{BASE_URL}}/catalog/categories",
					"host": [
						"{{BASE_URL}}"
					],
					"path": [
						"catalog",
						"categories"
					]
				},
				"description": "**Endpoint:** POST /\n**Route Name:** catalog-categories.store\n**Permission:** create-category\n**Status:** 201 Created / 400 Bad Request / 403 Forbidden\n\n**Description:** Create a new category with multilingual support.\n\n**Request Body Fields:**\n- name (object, required): Multilingual names {en, ar, tr, ur}\n- slug (string, required): URL-friendly name (unique)\n- code (string, required): Category code (unique)\n- parent_id (integer, optional): Parent category ID for hierarchy\n- description (object, optional): Multilingual descriptions\n- meta (object, optional): Custom metadata (JSON)\n- is_active (boolean, optional): Active status (default: true)\n\n**Response (201):**\n```json\n{\n  \"success\": true,\n  \"message\": \"Category created successfully\",\n  \"data\": {\n    \"id\": 1,\n    \"name\": { \"en\": \"Electronics\" },\n    \"slug\": \"electronics\",\n    \"code\": \"ELEC-001\",\n    \"is_active\": true,\n    \"created_by\": 1,\n    \"created_at\": \"2025-12-19T10:30:00Z\"\n  }\n}\n```"
			},
			"response": []
		},
		{
			"name": "Update Category",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							"pm.test('Status code is 200', function() {",
							"    pm.response.to.have.status(200);",
							"});",
							"",
							"pm.test('Response indicates success', function() {",
							"    var jsonData = pm.response.json();",
							"    pm.expect(jsonData.success).to.equal(true);",
							"});"
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "PUT",
				"header": [
					{
						"key": "Authorization",
						"value": "Bearer {{access_token}}",
						"type": "text"
					},
					{
						"key": "Content-Type",
						"value": "application/json",
						"type": "text"
					},
					{
						"key": "Accept",
						"value": "application/json",
						"type": "text"
					}
				],
				"body": {
					"mode": "raw",
					"raw": "{\n  \"name\": {\n    \"en\": \"Electronic Devices\",\n    \"ar\": \"أجهزة إلكترونية\",\n    \"tr\": \"Elektronik Cihazlar\",\n    \"ur\": \"الیکٹرانک ڈیوائسز\"\n  },\n  \"slug\": \"electronic-devices\",\n  \"code\": \"ELEC-002\",\n  \"description\": {\n    \"en\": \"All types of electronic devices and gadgets\",\n    \"ar\": \"جميع أنواع الأجهزة الإلكترونية والملحقات\"\n  },\n  \"meta\": {\n    \"icon\": \"devices\",\n    \"color\": \"#2196F3\",\n    \"order\": 1\n  },\n  \"is_active\": true\n}"
				},
				"url": {
					"raw": "{{BASE_URL}}/catalog/categories/1",
					"host": [
						"{{BASE_URL}}"
					],
					"path": [
						"catalog",
						"categories",
						"1"
					]
				},
				"description": "**Endpoint:** PUT /{id}\n**Route Name:** catalog-categories.update\n**Permission:** update-category\n**Status:** 200 OK / 404 Not Found / 403 Forbidden\n\n**Description:** Update an existing category's details.\n\n**URL Parameters:**\n- id (integer, required): Category ID\n\n**Request Body:** Same fields as Create (all optional)\n\n**Response (200):**\n```json\n{\n  \"success\": true,\n  \"message\": \"Category updated successfully\",\n  \"data\": {\n    \"id\": 1,\n    \"name\": { \"en\": \"Electronic Devices\" },\n    \"slug\": \"electronic-devices\",\n    \"code\": \"ELEC-002\",\n    \"updated_at\": \"2025-12-19T11:00:00Z\"\n  }\n}\n```"
			},
			"response": []
		},
		{
			"name": "Delete Category",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							"pm.test('Status code is 200', function() {",
							"    pm.response.to.have.status(200);",
							"});",
							"",
							"pm.test('Response indicates deletion', function() {",
							"    var jsonData = pm.response.json();",
							"    pm.expect(jsonData.success).to.equal(true);",
							"});"
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "DELETE",
				"header": [
					{
						"key": "Authorization",
						"value": "Bearer {{access_token}}",
						"type": "text"
					},
					{
						"key": "Accept",
						"value": "application/json",
						"type": "text"
					}
				],
				"url": {
					"raw": "{{BASE_URL}}/catalog/categories/1",
					"host": [
						"{{BASE_URL}}"
					],
					"path": [
						"catalog",
						"categories",
						"1"
					]
				},
				"description": "**Endpoint:** DELETE /{id}\n**Route Name:** catalog-categories.destroy\n**Permission:** delete-category\n**Status:** 200 OK / 404 Not Found / 403 Forbidden\n\n**Description:** Soft delete a category (can be restored). Does NOT permanently delete data.\n\n**URL Parameters:**\n- id (integer, required): Category ID\n\n**Response (200):**\n```json\n{\n  \"success\": true,\n  \"message\": \"Category deleted successfully\"\n}\n```"
			},
			"response": []
		},
		{
			"name": "Restore Deleted Category",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							"pm.test('Status code is 200', function() {",
							"    pm.response.to.have.status(200);",
							"});",
							"",
							"pm.test('Response indicates restoration', function() {",
							"    var jsonData = pm.response.json();",
							"    pm.expect(jsonData.success).to.equal(true);",
							"});"
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Authorization",
						"value": "Bearer {{access_token}}",
						"type": "text"
					},
					{
						"key": "Accept",
						"value": "application/json",
						"type": "text"
					}
				],
				"url": {
					"raw": "{{BASE_URL}}/catalog/categories/1/restore",
					"host": [
						"{{BASE_URL}}"
					],
					"path": [
						"catalog",
						"categories",
						"1",
						"restore"
					]
				},
				"description": "**Endpoint:** POST /{id}/restore\n**Route Name:** catalog-categories.restore\n**Permission:** restore-category\n**Status:** 200 OK / 404 Not Found / 403 Forbidden\n\n**Description:** Restore a previously soft-deleted category.\n\n**URL Parameters:**\n- id (integer, required): Category ID (must be deleted)\n\n**Response (200):**\n```json\n{\n  \"success\": true,\n  \"message\": \"Category restored successfully\",\n  \"data\": {\n    \"id\": 1,\n    \"name\": { \"en\": \"Electronics\" },\n    \"slug\": \"electronics\",\n    \"is_active\": true,\n    \"updated_at\": \"2025-12-19T11:15:00Z\"\n  }\n}\n```"
			},
			"response": []
		},
		{
			"name": "Bulk Delete Categories",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							"pm.test('Status code is 200', function() {",
							"    pm.response.to.have.status(200);",
							"});",
							"",
							"pm.test('Response has deletion info', function() {",
							"    var jsonData = pm.response.json();",
							"    pm.expect(jsonData.data.deleted_count).to.exist;",
							"    pm.expect(jsonData.data.ids).to.be.an('array');",
							"});"
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Authorization",
						"value": "Bearer {{access_token}}",
						"type": "text"
					},
					{
						"key": "Content-Type",
						"value": "application/json",
						"type": "text"
					},
					{
						"key": "Accept",
						"value": "application/json",
						"type": "text"
					}
				],
				"body": {
					"mode": "raw",
					"raw": "{\n  \"ids\": [1, 2, 3]\n}"
				},
				"url": {
					"raw": "{{BASE_URL}}/catalog/categories/bulk/delete",
					"host": [
						"{{BASE_URL}}"
					],
					"path": [
						"catalog",
						"categories",
						"bulk",
						"delete"
					]
				},
				"description": "**Endpoint:** POST /bulk/delete\n**Route Name:** catalog-categories.bulk-delete\n**Permission:** delete-category\n**Status:** 200 OK / 400 Bad Request / 403 Forbidden\n\n**Description:** Soft delete multiple categories at once. Does NOT permanently delete data.\n\n**Request Body:**\n```json\n{\n  \"ids\": [1, 2, 3]\n}\n```\n\n**Request Body Fields:**\n- ids (array, required): Array of category IDs (min: 1, max: 100)\n\n**Response (200):**\n```json\n{\n  \"success\": true,\n  \"message\": \"Categories deleted successfully\",\n  \"data\": {\n    \"deleted_count\": 3,\n    \"ids\": [1, 2, 3]\n  }\n}\n```"
			},
			"response": []
		}
	],
	"event": [
		{
			"listen": "prerequest",
			"script": {
				"type": "text/javascript",
				"packages": {},
				"requests": {},
				"exec": [
					""
				]
			}
		},
		{
			"listen": "test",
			"script": {
				"type": "text/javascript",
				"packages": {},
				"requests": {},
				"exec": [
					""
				]
			}
		}
	],
	"variable": [
		{
			"key": "BASE_URL",
			"value": "http://localhost:8000/api/v1/catalog"
		},
		{
			"key": "access_token",
			"value": ""
		}
	]
}