{
	"info": {
		"_postman_id": "dynamic-pricing-system-2026",
		"name": "Dynamic Pricing System - Sales Quotations",
		"description": "API collection for the Dynamic Pricing System for Sales Quotations.\n\nThis collection includes all endpoints for:\n- Target Net Total Distribution\n- Distribution Inclusion Toggle\n- Manual Price Updates (Auto-Lock)\n- Pricing Validation\n- Audit Trail\n- Distribution Eligibility\n\nBase URL: {{BASE_URL}}/supply",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
	},
	"variable": [
		{
			"key": "quotation_id",
			"value": "1",
			"type": "string"
		},
		{
			"key": "strategy_id",
			"value": "1",
			"type": "string"
		},
		{
			"key": "token",
			"value": "",
			"type": "string"
		}
	],
	"auth": {
		"type": "bearer",
		"bearer": [
			{
				"key": "token",
				"value": "{{token}}",
				"type": "string"
			}
		]
	},
	"item": [
		{
			"name": "Target Net Total Distribution",
			"item": [
				{
					"name": "Preview Target Net Total Distribution",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json"
							},
							{
								"key": "Accept",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"target_net_total\": 50000.00\n}"
						},
						"url": {
							"raw": "{{BASE_URL}}/supply/quotations/{{quotation_id}}/pricing/target-net-total/preview",
							"host": [
								"{{BASE_URL}}"
							],
							"path": [
								"supply",
								"quotations",
								"{{quotation_id}}",
								"pricing",
								"target-net-total",
								"preview"
							]
						},
						"description": "Preview the target net total distribution without applying changes.\n\nThis endpoint calculates how the difference between the target total and current total would be distributed among eligible items (proportional to cost).\n\n**Response includes:**\n- Current and target net totals\n- Adjustment required\n- Preview of each item's proposed price change\n- Warnings (locked items, negative margins, etc.)\n- Whether distribution can be applied"
					},
					"response": [
						{
							"name": "Success - Preview Generated",
							"originalRequest": {
								"method": "POST",
								"body": {
									"mode": "raw",
									"raw": "{\n    \"target_net_total\": 50000.00\n}"
								},
								"url": {
									"raw": "{{BASE_URL}}/supply/quotations/1/pricing/target-net-total/preview",
									"host": ["{{BASE_URL}}"],
									"path": ["supply", "quotations", "1", "pricing", "target-net-total", "preview"]
								}
							},
							"status": "OK",
							"code": 200,
							"_postman_previewlanguage": "json",
							"body": "{\n    \"success\": true,\n    \"message\": \"Target net total preview generated successfully\",\n    \"data\": {\n        \"current_net_total\": 45000.00,\n        \"target_net_total\": 50000.00,\n        \"adjustment_required\": 5000.00,\n        \"eligible_items_count\": 8,\n        \"locked_items_count\": 2,\n        \"excluded_items_count\": 1,\n        \"total_items_count\": 11,\n        \"preview_items\": [\n            {\n                \"quote_id\": 1,\n                \"item_name\": \"Steel Beam A\",\n                \"supplier_name\": \"ABC Suppliers\",\n                \"cost_price\": 1000.00,\n                \"current_selling_price\": 1200.00,\n                \"proposed_selling_price\": 1350.00,\n                \"adjustment_amount\": 150.00,\n                \"current_margin\": 20.00,\n                \"proposed_margin\": 35.00,\n                \"is_eligible\": true,\n                \"has_negative_margin\": false\n            },\n            {\n                \"quote_id\": 5,\n                \"item_name\": \"Concrete Mix\",\n                \"supplier_name\": \"XYZ Materials\",\n                \"cost_price\": 500.00,\n                \"current_selling_price\": 500.00,\n                \"proposed_selling_price\": 500.00,\n                \"adjustment_amount\": 0,\n                \"current_margin\": 0,\n                \"proposed_margin\": 0,\n                \"is_eligible\": false,\n                \"is_locked\": true,\n                \"excluded_from_distribution\": false\n            }\n        ],\n        \"warnings\": [\n            {\n                \"code\": \"items_locked_or_excluded\",\n                \"message\": \"3 item(s) are locked or excluded from distribution\"\n            }\n        ],\n        \"can_apply\": true,\n        \"has_negative_margins\": false\n    }\n}"
						}
					]
				},
				{
					"name": "Apply Target Net Total Distribution",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json"
							},
							{
								"key": "Accept",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"target_net_total\": 50000.00\n}"
						},
						"url": {
							"raw": "{{BASE_URL}}/supply/quotations/{{quotation_id}}/pricing/target-net-total",
							"host": [
								"{{BASE_URL}}"
							],
							"path": [
								"supply",
								"quotations",
								"{{quotation_id}}",
								"pricing",
								"target-net-total"
							]
						},
						"description": "Apply target net total distribution to the quotation.\n\nThis endpoint:\n1. Calculates the difference between target and current total\n2. Distributes the difference proportionally to cost among eligible items\n3. Enforces minimum price rule (selling_price >= cost_price)\n4. Records audit trail for each change\n5. Returns the updated target pricing record\n\n**Business Rules:**\n- Only unlocked items with `included_in_distribution=true` are affected\n- Selling price cannot go below cost price\n- Rounding errors are added to the highest-cost item"
					},
					"response": [
						{
							"name": "Success - Distribution Applied",
							"originalRequest": {
								"method": "POST",
								"body": {
									"mode": "raw",
									"raw": "{\n    \"target_net_total\": 50000.00\n}"
								},
								"url": {
									"raw": "{{BASE_URL}}/supply/quotations/1/pricing/target-net-total",
									"host": ["{{BASE_URL}}"],
									"path": ["supply", "quotations", "1", "pricing", "target-net-total"]
								}
							},
							"status": "Created",
							"code": 201,
							"_postman_previewlanguage": "json",
							"body": "{\n    \"success\": true,\n    \"message\": \"Target net total distribution applied successfully\",\n    \"data\": {\n        \"id\": 1,\n        \"sup_quotation_id\": 1,\n        \"target_type\": \"target_net_total\",\n        \"target_net_total\": \"50000.00\",\n        \"current_net_total\": \"50000.00\",\n        \"target_value\": \"50000.00\",\n        \"adjustment_amount\": \"5000.00\",\n        \"items_included\": 8,\n        \"items_locked\": 3,\n        \"status\": \"applied\",\n        \"has_negative_margins\": false,\n        \"distribution_summary\": {\n            \"method_used\": \"proportional_to_cost\",\n            \"target_net_total\": 50000,\n            \"original_net_total\": 45000,\n            \"actual_new_net_total\": 50000,\n            \"total_adjustment\": 5000,\n            \"items_adjusted\": 8,\n            \"items_excluded\": 3\n        },\n        \"created_at\": \"2026-01-27T10:30:00.000000Z\",\n        \"updated_at\": \"2026-01-27T10:30:00.000000Z\"\n    }\n}"
						},
						{
							"name": "Error - All Items Locked",
							"originalRequest": {
								"method": "POST",
								"body": {
									"mode": "raw",
									"raw": "{\n    \"target_net_total\": 50000.00\n}"
								},
								"url": {
									"raw": "{{BASE_URL}}/supply/quotations/1/pricing/target-net-total",
									"host": ["{{BASE_URL}}"],
									"path": ["supply", "quotations", "1", "pricing", "target-net-total"]
								}
							},
							"status": "Unprocessable Entity",
							"code": 422,
							"_postman_previewlanguage": "json",
							"body": "{\n    \"success\": false,\n    \"message\": \"No eligible items for distribution. All items may be locked or excluded from distribution.\"\n}"
						}
					]
				}
			],
			"description": "Endpoints for applying target net total distribution to quotations."
		},
		{
			"name": "Distribution Inclusion",
			"item": [
				{
					"name": "Toggle Distribution Inclusion",
					"request": {
						"method": "PATCH",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json"
							},
							{
								"key": "Accept",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"quote_ids\": [1, 2, 3],\n    \"include_in_distribution\": true\n}"
						},
						"url": {
							"raw": "{{BASE_URL}}/supply/quotations/{{quotation_id}}/pricing/items/toggle-distribution",
							"host": [
								"{{BASE_URL}}"
							],
							"path": [
								"supply",
								"quotations",
								"{{quotation_id}}",
								"pricing",
								"items",
								"toggle-distribution"
							]
						},
						"description": "Toggle whether items are included in target distribution calculations.\n\n**Use cases:**\n- Exclude specific items from automatic price adjustments\n- Re-include previously excluded items\n- Fine-tune which items participate in distribution\n\n**Parameters:**\n- `quote_ids`: Array of supplier quote IDs to update\n- `include_in_distribution`: Boolean - true to include, false to exclude"
					},
					"response": [
						{
							"name": "Success - Items Included",
							"originalRequest": {
								"method": "PATCH",
								"body": {
									"mode": "raw",
									"raw": "{\n    \"quote_ids\": [1, 2, 3],\n    \"include_in_distribution\": true\n}"
								},
								"url": {
									"raw": "{{BASE_URL}}/supply/quotations/1/pricing/items/toggle-distribution",
									"host": ["{{BASE_URL}}"],
									"path": ["supply", "quotations", "1", "pricing", "items", "toggle-distribution"]
								}
							},
							"status": "OK",
							"code": 200,
							"_postman_previewlanguage": "json",
							"body": "{\n    \"success\": true,\n    \"message\": \"Items included in distribution successfully\",\n    \"data\": {\n        \"updated_count\": 3,\n        \"results\": [\n            {\n                \"quote_id\": 1,\n                \"status\": \"success\",\n                \"included_in_distribution\": true\n            },\n            {\n                \"quote_id\": 2,\n                \"status\": \"success\",\n                \"included_in_distribution\": true\n            },\n            {\n                \"quote_id\": 3,\n                \"status\": \"success\",\n                \"included_in_distribution\": true\n            }\n        ]\n    }\n}"
						},
						{
							"name": "Success - Items Excluded",
							"originalRequest": {
								"method": "PATCH",
								"body": {
									"mode": "raw",
									"raw": "{\n    \"quote_ids\": [4, 5],\n    \"include_in_distribution\": false\n}"
								},
								"url": {
									"raw": "{{BASE_URL}}/supply/quotations/1/pricing/items/toggle-distribution",
									"host": ["{{BASE_URL}}"],
									"path": ["supply", "quotations", "1", "pricing", "items", "toggle-distribution"]
								}
							},
							"status": "OK",
							"code": 200,
							"_postman_previewlanguage": "json",
							"body": "{\n    \"success\": true,\n    \"message\": \"Items excluded from distribution successfully\",\n    \"data\": {\n        \"updated_count\": 2,\n        \"results\": [\n            {\n                \"quote_id\": 4,\n                \"status\": \"success\",\n                \"included_in_distribution\": false\n            },\n            {\n                \"quote_id\": 5,\n                \"status\": \"success\",\n                \"included_in_distribution\": false\n            }\n        ]\n    }\n}"
						}
					]
				},
				{
					"name": "Get Distribution Eligibility",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json"
							}
						],
						"url": {
							"raw": "{{BASE_URL}}/supply/quotations/{{quotation_id}}/pricing/distribution-eligibility",
							"host": [
								"{{BASE_URL}}"
							],
							"path": [
								"supply",
								"quotations",
								"{{quotation_id}}",
								"pricing",
								"distribution-eligibility"
							]
						},
						"description": "Get a summary of distribution eligibility for all items in the quotation.\n\n**Returns:**\n- Total items count\n- Eligible items count (not locked AND included in distribution)\n- Locked items count\n- Excluded items count\n- Items with negative margins\n- Total cost, selling price, and profit\n- Whether distribution can be performed"
					},
					"response": [
						{
							"name": "Success - Eligibility Summary",
							"originalRequest": {
								"method": "GET",
								"url": {
									"raw": "{{BASE_URL}}/supply/quotations/1/pricing/distribution-eligibility",
									"host": ["{{BASE_URL}}"],
									"path": ["supply", "quotations", "1", "pricing", "distribution-eligibility"]
								}
							},
							"status": "OK",
							"code": 200,
							"_postman_previewlanguage": "json",
							"body": "{\n    \"success\": true,\n    \"message\": \"Distribution eligibility retrieved successfully\",\n    \"data\": {\n        \"total_items\": 15,\n        \"eligible_items\": 10,\n        \"locked_items\": 3,\n        \"excluded_items\": 2,\n        \"negative_margin_items\": 1,\n        \"total_cost\": 35000.00,\n        \"total_selling_price\": 42000.00,\n        \"total_profit\": 7000.00,\n        \"can_distribute\": true,\n        \"all_items_locked\": false\n    }\n}"
						}
					]
				}
			],
			"description": "Endpoints for managing which items participate in target distribution."
		},
		{
			"name": "Manual Price Update",
			"item": [
				{
					"name": "Update Manual Price (Auto-Locks)",
					"request": {
						"method": "PATCH",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json"
							},
							{
								"key": "Accept",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"selling_price\": 1500.00\n}"
						},
						"url": {
							"raw": "{{BASE_URL}}/supply/quotations/{{quotation_id}}/pricing/{{strategy_id}}/manual-price",
							"host": [
								"{{BASE_URL}}"
							],
							"path": [
								"supply",
								"quotations",
								"{{quotation_id}}",
								"pricing",
								"{{strategy_id}}",
								"manual-price"
							]
						},
						"description": "Manually update the selling price for an item.\n\n**Important:** This action automatically:\n1. Changes the pricing strategy to 'manual'\n2. Locks the item (prevents future distribution changes)\n3. Records an audit trail entry\n\n**Validation:**\n- Selling price must be >= cost price (hard rule)\n\n**Use case:** When the sales manager wants to override calculated prices with a specific value."
					},
					"response": [
						{
							"name": "Success - Price Updated and Locked",
							"originalRequest": {
								"method": "PATCH",
								"body": {
									"mode": "raw",
									"raw": "{\n    \"selling_price\": 1500.00\n}"
								},
								"url": {
									"raw": "{{BASE_URL}}/supply/quotations/1/pricing/5/manual-price",
									"host": ["{{BASE_URL}}"],
									"path": ["supply", "quotations", "1", "pricing", "5", "manual-price"]
								}
							},
							"status": "OK",
							"code": 200,
							"_postman_previewlanguage": "json",
							"body": "{\n    \"success\": true,\n    \"message\": \"Selling price updated manually and item locked successfully\",\n    \"data\": {\n        \"id\": 5,\n        \"sup_supplier_quote_id\": 10,\n        \"strategy_type\": \"manual\",\n        \"strategy_value\": \"1500.00\",\n        \"cost_price\": \"1000.00\",\n        \"calculated_selling_price\": \"1500.00\",\n        \"profit_amount\": \"500.00\",\n        \"profit_margin_percentage\": \"50.00\",\n        \"is_locked\": true,\n        \"lock_reason\": null,\n        \"auto_locked_at\": \"2026-01-27T10:30:00.000000Z\",\n        \"auto_lock_trigger\": \"manual_price_edit\",\n        \"supplier_quote\": {\n            \"id\": 10,\n            \"quote_number\": \"SQ-2026-0010\",\n            \"pricing_locked\": true,\n            \"auto_locked\": true\n        }\n    }\n}"
						},
						{
							"name": "Error - Price Below Cost",
							"originalRequest": {
								"method": "PATCH",
								"body": {
									"mode": "raw",
									"raw": "{\n    \"selling_price\": 800.00\n}"
								},
								"url": {
									"raw": "{{BASE_URL}}/supply/quotations/1/pricing/5/manual-price",
									"host": ["{{BASE_URL}}"],
									"path": ["supply", "quotations", "1", "pricing", "5", "manual-price"]
								}
							},
							"status": "Unprocessable Entity",
							"code": 422,
							"_postman_previewlanguage": "json",
							"body": "{\n    \"success\": false,\n    \"message\": \"Selling price cannot be less than cost price\"\n}"
						}
					]
				}
			],
			"description": "Endpoints for manually updating prices (triggers auto-lock)."
		},
		{
			"name": "Validation",
			"item": [
				{
					"name": "Get Pricing Validation",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json"
							}
						],
						"url": {
							"raw": "{{BASE_URL}}/supply/quotations/{{quotation_id}}/pricing/validation",
							"host": [
								"{{BASE_URL}}"
							],
							"path": [
								"supply",
								"quotations",
								"{{quotation_id}}",
								"pricing",
								"validation"
							]
						},
						"description": "Get all validation errors and warnings for the quotation's pricing.\n\n**Validates:**\n- Selling price >= cost price (hard error)\n- Negative profit margins (warning)\n- Low margins < 5% (info)\n\n**Returns:**\n- Overall validity status\n- Total error and warning counts\n- Detailed list of issues per item"
					},
					"response": [
						{
							"name": "Success - Validation Results",
							"originalRequest": {
								"method": "GET",
								"url": {
									"raw": "{{BASE_URL}}/supply/quotations/1/pricing/validation",
									"host": ["{{BASE_URL}}"],
									"path": ["supply", "quotations", "1", "pricing", "validation"]
								}
							},
							"status": "OK",
							"code": 200,
							"_postman_previewlanguage": "json",
							"body": "{\n    \"success\": true,\n    \"message\": \"Pricing validation completed\",\n    \"data\": {\n        \"quotation_id\": 1,\n        \"is_valid\": false,\n        \"total_items\": 15,\n        \"items_with_issues\": 3,\n        \"error_count\": 1,\n        \"warning_count\": 2,\n        \"errors\": [\n            {\n                \"code\": \"selling_price_below_cost\",\n                \"message\": \"Selling price cannot be less than cost price\",\n                \"quote_id\": 7,\n                \"details\": {\n                    \"selling_price\": 900.00,\n                    \"cost_price\": 1000.00,\n                    \"difference\": 100.00\n                }\n            }\n        ],\n        \"warnings\": [\n            {\n                \"code\": \"negative_margin\",\n                \"message\": \"Item has negative profit margin\",\n                \"quote_id\": 7,\n                \"severity\": \"warning\",\n                \"details\": {\n                    \"profit_amount\": -100.00,\n                    \"margin_percentage\": -10.00\n                }\n            },\n            {\n                \"code\": \"low_margin\",\n                \"message\": \"Item has very low profit margin (< 5%)\",\n                \"quote_id\": 12,\n                \"severity\": \"info\",\n                \"details\": {\n                    \"margin_percentage\": 3.50\n                }\n            }\n        ],\n        \"item_details\": [\n            {\n                \"quote_id\": 7,\n                \"item_name\": \"Steel Beam B\",\n                \"errors\": [{\"code\": \"selling_price_below_cost\", \"...\": \"...\"}],\n                \"warnings\": [{\"code\": \"negative_margin\", \"...\": \"...\"}]\n            }\n        ]\n    }\n}"
						}
					]
				},
				{
					"name": "Validate for Send",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json"
							}
						],
						"url": {
							"raw": "{{BASE_URL}}/supply/quotations/{{quotation_id}}/pricing/validate-for-send",
							"host": [
								"{{BASE_URL}}"
							],
							"path": [
								"supply",
								"quotations",
								"{{quotation_id}}",
								"pricing",
								"validate-for-send"
							]
						},
						"description": "Validate the quotation before sending to the customer.\n\n**Checks:**\n- Items with selling price below cost (blocking error)\n- Items without pricing set (blocking error)\n- Negative profit margins (warning - doesn't block)\n- Overall quotation margin (warning if negative)\n- All items locked status (info)\n\n**Returns:**\n- `can_send`: Boolean indicating if quotation can be sent\n- Summary with totals and margins\n- List of errors and warnings"
					},
					"response": [
						{
							"name": "Success - Can Send",
							"originalRequest": {
								"method": "POST",
								"url": {
									"raw": "{{BASE_URL}}/supply/quotations/1/pricing/validate-for-send",
									"host": ["{{BASE_URL}}"],
									"path": ["supply", "quotations", "1", "pricing", "validate-for-send"]
								}
							},
							"status": "OK",
							"code": 200,
							"_postman_previewlanguage": "json",
							"body": "{\n    \"success\": true,\n    \"message\": \"Quotation is valid and can be sent\",\n    \"data\": {\n        \"quotation_id\": 1,\n        \"is_valid\": true,\n        \"can_send\": true,\n        \"error_count\": 0,\n        \"warning_count\": 1,\n        \"errors\": [],\n        \"warnings\": [\n            {\n                \"code\": \"has_negative_margins\",\n                \"message\": \"2 item(s) have negative profit margins\",\n                \"severity\": \"warning\",\n                \"quote_ids\": [7, 12]\n            }\n        ],\n        \"summary\": {\n            \"total_items\": 15,\n            \"total_cost\": 35000.00,\n            \"total_selling_price\": 42000.00,\n            \"total_profit\": 7000.00,\n            \"overall_margin_percentage\": 20.00,\n            \"locked_items\": 5,\n            \"negative_margin_items\": 2\n        }\n    }\n}"
						},
						{
							"name": "Error - Cannot Send",
							"originalRequest": {
								"method": "POST",
								"url": {
									"raw": "{{BASE_URL}}/supply/quotations/1/pricing/validate-for-send",
									"host": ["{{BASE_URL}}"],
									"path": ["supply", "quotations", "1", "pricing", "validate-for-send"]
								}
							},
							"status": "OK",
							"code": 200,
							"_postman_previewlanguage": "json",
							"body": "{\n    \"success\": true,\n    \"message\": \"Quotation has validation errors that must be fixed before sending\",\n    \"data\": {\n        \"quotation_id\": 1,\n        \"is_valid\": false,\n        \"can_send\": false,\n        \"error_count\": 2,\n        \"warning_count\": 1,\n        \"errors\": [\n            {\n                \"code\": \"items_below_cost\",\n                \"message\": \"2 item(s) have selling price below cost price\",\n                \"severity\": \"error\",\n                \"quote_ids\": [7, 9]\n            },\n            {\n                \"code\": \"items_without_pricing\",\n                \"message\": \"1 item(s) do not have a selling price set\",\n                \"severity\": \"error\",\n                \"quote_ids\": [15]\n            }\n        ],\n        \"warnings\": [\n            {\n                \"code\": \"overall_negative_margin\",\n                \"message\": \"Overall quotation has negative profit margin\",\n                \"severity\": \"warning\",\n                \"details\": {\n                    \"overall_margin_percentage\": -5.00,\n                    \"total_profit\": -1750.00\n                }\n            }\n        ],\n        \"summary\": {\n            \"total_items\": 15,\n            \"total_cost\": 35000.00,\n            \"total_selling_price\": 33250.00,\n            \"total_profit\": -1750.00,\n            \"overall_margin_percentage\": -5.00,\n            \"locked_items\": 3,\n            \"negative_margin_items\": 4\n        }\n    }\n}"
						}
					]
				}
			],
			"description": "Endpoints for validating quotation pricing before sending to customers."
		},
		{
			"name": "Audit Trail",
			"item": [
				{
					"name": "Get Pricing Audit Trail",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json"
							}
						],
						"url": {
							"raw": "{{BASE_URL}}/supply/quotations/{{quotation_id}}/pricing/audit-trail?limit=50&action=",
							"host": [
								"{{BASE_URL}}"
							],
							"path": [
								"supply",
								"quotations",
								"{{quotation_id}}",
								"pricing",
								"audit-trail"
							],
							"query": [
								{
									"key": "limit",
									"value": "50",
									"description": "Maximum number of entries to return (default: 50)"
								},
								{
									"key": "action",
									"value": "",
									"description": "Filter by action type: created, updated, locked, unlocked, distributed, manual_edit, strategy_applied, auto_locked"
								}
							]
						},
						"description": "Get the pricing change history for the quotation.\n\n**Tracks:**\n- Strategy creation and updates\n- Lock/unlock actions\n- Distribution applications\n- Manual price edits\n- Auto-lock events\n\n**Query Parameters:**\n- `limit`: Maximum entries to return (default: 50)\n- `action`: Filter by action type\n\n**Action Types:**\n- `created` - Strategy created\n- `updated` - Strategy updated\n- `locked` - Item locked\n- `unlocked` - Item unlocked\n- `distributed` - Distribution applied\n- `manual_edit` - Manual price change\n- `strategy_applied` - Bulk strategy applied\n- `auto_locked` - Auto-locked after manual edit"
					},
					"response": [
						{
							"name": "Success - Audit Trail",
							"originalRequest": {
								"method": "GET",
								"url": {
									"raw": "{{BASE_URL}}/supply/quotations/1/pricing/audit-trail?limit=10",
									"host": ["{{BASE_URL}}"],
									"path": ["supply", "quotations", "1", "pricing", "audit-trail"],
									"query": [{"key": "limit", "value": "10"}]
								}
							},
							"status": "OK",
							"code": 200,
							"_postman_previewlanguage": "json",
							"body": "{\n    \"success\": true,\n    \"message\": \"Audit trail retrieved successfully\",\n    \"data\": {\n        \"total\": 10,\n        \"audit_entries\": [\n            {\n                \"id\": 25,\n                \"action\": \"distributed\",\n                \"action_label\": \"Distribution Applied\",\n                \"old_values\": {\n                    \"selling_price\": 1200.00\n                },\n                \"new_values\": {\n                    \"selling_price\": 1350.00,\n                    \"profit_amount\": 350.00,\n                    \"margin_percentage\": 35.00\n                },\n                \"change_summary\": \"selling_price: 1200.00 → 1350.00\",\n                \"change_reason\": \"Target net total distribution\",\n                \"changed_by\": {\n                    \"id\": 5,\n                    \"name\": \"John Smith\"\n                },\n                \"created_at\": \"2026-01-27T10:30:00.000000Z\",\n                \"auditable_type\": \"SupplierQuote\",\n                \"auditable_id\": 10\n            },\n            {\n                \"id\": 24,\n                \"action\": \"manual_edit\",\n                \"action_label\": \"Manual Price Edit\",\n                \"old_values\": {\n                    \"selling_price\": 1100.00,\n                    \"strategy_type\": \"percentage\",\n                    \"pricing_locked\": false\n                },\n                \"new_values\": {\n                    \"selling_price\": 1500.00,\n                    \"strategy_type\": \"manual\",\n                    \"pricing_locked\": true,\n                    \"auto_locked\": true\n                },\n                \"change_summary\": \"selling_price: 1100.00 → 1500.00, strategy_type: percentage → manual\",\n                \"change_reason\": \"Manual price update\",\n                \"changed_by\": {\n                    \"id\": 5,\n                    \"name\": \"John Smith\"\n                },\n                \"created_at\": \"2026-01-27T09:15:00.000000Z\",\n                \"auditable_type\": \"SupplierQuote\",\n                \"auditable_id\": 8\n            },\n            {\n                \"id\": 23,\n                \"action\": \"locked\",\n                \"action_label\": \"Locked\",\n                \"old_values\": {\n                    \"is_locked\": false,\n                    \"lock_reason\": null\n                },\n                \"new_values\": {\n                    \"is_locked\": true,\n                    \"lock_reason\": \"manual_override\"\n                },\n                \"change_summary\": \"is_locked: false → true\",\n                \"change_reason\": \"manual_override\",\n                \"changed_by\": {\n                    \"id\": 5,\n                    \"name\": \"John Smith\"\n                },\n                \"created_at\": \"2026-01-27T08:45:00.000000Z\",\n                \"auditable_type\": \"PricingStrategy\",\n                \"auditable_id\": 5\n            }\n        ]\n    }\n}"
						},
						{
							"name": "Success - Filtered by Action",
							"originalRequest": {
								"method": "GET",
								"url": {
									"raw": "{{BASE_URL}}/supply/quotations/1/pricing/audit-trail?action=manual_edit",
									"host": ["{{BASE_URL}}"],
									"path": ["supply", "quotations", "1", "pricing", "audit-trail"],
									"query": [{"key": "action", "value": "manual_edit"}]
								}
							},
							"status": "OK",
							"code": 200,
							"_postman_previewlanguage": "json",
							"body": "{\n    \"success\": true,\n    \"message\": \"Audit trail retrieved successfully\",\n    \"data\": {\n        \"total\": 3,\n        \"audit_entries\": [\n            {\n                \"id\": 24,\n                \"action\": \"manual_edit\",\n                \"action_label\": \"Manual Price Edit\",\n                \"old_values\": {\"selling_price\": 1100.00},\n                \"new_values\": {\"selling_price\": 1500.00},\n                \"change_summary\": \"selling_price: 1100.00 → 1500.00\",\n                \"change_reason\": \"Manual price update\",\n                \"changed_by\": {\"id\": 5, \"name\": \"John Smith\"},\n                \"created_at\": \"2026-01-27T09:15:00.000000Z\",\n                \"auditable_type\": \"SupplierQuote\",\n                \"auditable_id\": 8\n            }\n        ]\n    }\n}"
						}
					]
				}
			],
			"description": "Endpoints for viewing pricing change history and audit trail."
		},
		{
			"name": "Existing Endpoints (Reference)",
			"item": [
				{
					"name": "Get Pricing Summary",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Accept",
								"value": "application/json"
							}
						],
						"url": {
							"raw": "{{BASE_URL}}/supply/quotations/{{quotation_id}}/pricing/summary",
							"host": [
								"{{BASE_URL}}"
							],
							"path": [
								"supply",
								"quotations",
								"{{quotation_id}}",
								"pricing",
								"summary"
							]
						},
						"description": "Get pricing summary for the quotation including total cost, selling price, profit, and margin."
					},
					"response": []
				},
				{
					"name": "Bulk Apply Strategy",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json"
							},
							{
								"key": "Accept",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"supplier_quote_ids\": [1, 2, 3, 4, 5],\n    \"strategy_type\": \"percentage\",\n    \"strategy_value\": 15,\n    \"force_override\": false\n}"
						},
						"url": {
							"raw": "{{BASE_URL}}/supply/quotations/{{quotation_id}}/pricing/bulk/apply",
							"host": [
								"{{BASE_URL}}"
							],
							"path": [
								"supply",
								"quotations",
								"{{quotation_id}}",
								"pricing",
								"bulk",
								"apply"
							]
						},
						"description": "Apply a pricing strategy to multiple items at once.\n\n**Strategy Types:**\n- `percentage` - Add percentage markup on cost\n- `fixed_amount` - Add fixed amount to cost\n- `manual` - Direct price entry\n- `cost_based` - Use cost as selling price\n- `locked` - Lock the price (NEW)\n- `cost_based_distributable` - Cost-based and eligible for distribution (NEW)"
					},
					"response": []
				},
				{
					"name": "Bulk Lock Items",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json"
							},
							{
								"key": "Accept",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"supplier_quote_ids\": [1, 2, 3],\n    \"reason\": \"price_approved_by_manager\"\n}"
						},
						"url": {
							"raw": "{{BASE_URL}}/supply/quotations/{{quotation_id}}/pricing/bulk/lock",
							"host": [
								"{{BASE_URL}}"
							],
							"path": [
								"supply",
								"quotations",
								"{{quotation_id}}",
								"pricing",
								"bulk",
								"lock"
							]
						},
						"description": "Lock multiple items to prevent price changes."
					},
					"response": []
				},
				{
					"name": "Bulk Unlock Items",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json"
							},
							{
								"key": "Accept",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n    \"supplier_quote_ids\": [1, 2, 3]\n}"
						},
						"url": {
							"raw": "{{BASE_URL}}/supply/quotations/{{quotation_id}}/pricing/bulk/unlock",
							"host": [
								"{{BASE_URL}}"
							],
							"path": [
								"supply",
								"quotations",
								"{{quotation_id}}",
								"pricing",
								"bulk",
								"unlock"
							]
						},
						"description": "Unlock multiple items to allow price changes."
					},
					"response": []
				},
				{
					"name": "Lock Single Strategy",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json"
							}
						],
						"url": {
							"raw": "{{BASE_URL}}/supply/quotations/{{quotation_id}}/pricing/{{strategy_id}}/lock",
							"host": [
								"{{BASE_URL}}"
							],
							"path": [
								"supply",
								"quotations",
								"{{quotation_id}}",
								"pricing",
								"{{strategy_id}}",
								"lock"
							]
						},
						"description": "Lock a single pricing strategy."
					},
					"response": []
				},
				{
					"name": "Unlock Single Strategy",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Accept",
								"value": "application/json"
							}
						],
						"url": {
							"raw": "{{BASE_URL}}/supply/quotations/{{quotation_id}}/pricing/{{strategy_id}}/unlock",
							"host": [
								"{{BASE_URL}}"
							],
							"path": [
								"supply",
								"quotations",
								"{{quotation_id}}",
								"pricing",
								"{{strategy_id}}",
								"unlock"
							]
						},
						"description": "Unlock a single pricing strategy."
					},
					"response": []
				}
			],
			"description": "Reference for existing pricing endpoints that were already in the system."
		}
	],
	"event": [
		{
			"listen": "prerequest",
			"script": {
				"type": "text/javascript",
				"exec": [
					""
				]
			}
		},
		{
			"listen": "test",
			"script": {
				"type": "text/javascript",
				"exec": [
					""
				]
			}
		}
	]
}
