{
    "info": {
        "_postman_id": "a1e6f2f0-2b9a-4a4a-9a4c-home00000001",
        "name": "Kalakhab - Home (Homepage)",
        "description": "Admin CRUD for the homepage document (draft, validate, publish) and the public storefront init endpoint. Prices in product snapshots are backend-generated only.",
        "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
    },
    "auth": {
        "type": "bearer",
        "bearer": [
            {
                "key": "token",
                "value": "{{token}}",
                "type": "string"
            }
        ]
    },
    "variable": [
        {
            "key": "base_url",
            "value": "http://192.168.1.104:8080/api/v1"
        },
        {
            "key": "token",
            "value": ""
        },
        {
            "key": "draft_revision",
            "value": "home_draft_43"
        }
    ],
    "item": [
        {
            "name": "Admin",
            "item": [
                {
                    "name": "Get Draft",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/admin/homepage",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "admin",
                                "homepage"
                            ]
                        },
                        "description": "Returns the current editable draft. Response carries an ETag header equal to data.revision."
                    }
                },
                {
                    "name": "Replace Draft",
                    "request": {
                        "method": "PUT",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            },
                            {
                                "key": "If-Match",
                                "value": "\"{{draft_revision}}\""
                            }
                        ],
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"schemaVersion\": 1,\n    \"revision\": \"{{draft_revision}}\",\n    \"seo\": {\n        \"title\": \"فروشگاه اینترنتی آواتار\",\n        \"description\": \"خرید آنلاین محصولات دیجیتال با ضمانت اصالت کالا\",\n        \"canonical\": \"https://shop.example.com/\",\n        \"robots\": \"index,follow\"\n    },\n    \"sections\": [\n        {\n            \"id\": \"home-hero-main\",\n            \"type\": \"hero_slider\",\n            \"data\": {\n                \"autoplayMs\": 6000,\n                \"slides\": [\n                    {\n                        \"id\": \"hero-mobile\",\n                        \"link\": {\n                            \"label\": \"مشاهده پیشنهادهای موبایل\",\n                            \"href\": \"/category/mobile\"\n                        },\n                        \"desktopMedia\": {\n                            \"url\": \"https://cdn.example.com/home/hero/mobile-desktop.webp\",\n                            \"width\": 1600,\n                            \"height\": 500,\n                            \"alt\": \"پیشنهادهای ویژه موبایل\"\n                        },\n                        \"mobileMedia\": {\n                            \"url\": \"https://cdn.example.com/home/hero/mobile-mobile.webp\",\n                            \"width\": 900,\n                            \"height\": 900,\n                            \"alt\": \"پیشنهادهای ویژه موبایل\"\n                        }\n                    }\n                ]\n            }\n        },\n        {\n            \"id\": \"home-autumn-banner\",\n            \"type\": \"image_banner\",\n            \"data\": {\n                \"link\": {\n                    \"label\": \"مشاهده جشنواره پاییزی\",\n                    \"href\": \"/shop?campaign=autumn\"\n                },\n                \"desktopMedia\": {\n                    \"url\": \"https://cdn.example.com/home/banners/autumn-desktop.webp\",\n                    \"width\": 1600,\n                    \"height\": 340,\n                    \"alt\": \"جشنواره پاییزی\"\n                },\n                \"mobileMedia\": {\n                    \"url\": \"https://cdn.example.com/home/banners/autumn-mobile.webp\",\n                    \"width\": 900,\n                    \"height\": 520,\n                    \"alt\": \"جشنواره پاییزی\"\n                }\n            }\n        },\n        {\n            \"id\": \"home-flash-sale\",\n            \"type\": \"product_carousel\",\n            \"data\": {\n                \"title\": \"پیشنهادهای شگفت‌انگیز\",\n                \"action\": {\n                    \"label\": \"مشاهده همه\",\n                    \"href\": \"/shop?campaign=flash-sale\"\n                },\n                \"variant\": \"flash_sale\",\n                \"products\": [\n                    {\n                        \"id\": \"14919\",\n                        \"slug\": \"xiaomi-poco-x6-pro\",\n                        \"sku\": \"20420312\",\n                        \"title\": \"گوشی شیائومی Poco X6 Pro\",\n                        \"brand\": {\n                            \"id\": \"11\",\n                            \"title\": \"شیائومی\",\n                            \"slug\": \"xiaomi\"\n                        },\n                        \"image\": {\n                            \"url\": \"https://cdn.example.com/products/14919.webp\",\n                            \"width\": 800,\n                            \"height\": 800,\n                            \"alt\": \"گوشی شیائومی Poco X6 Pro\"\n                        },\n                        \"price\": 28500000,\n                        \"previousPrice\": 31000000,\n                        \"currency\": \"IRT\",\n                        \"inStock\": true,\n                        \"stockStatus\": \"in_stock\",\n                        \"badges\": [\n                            {\n                                \"key\": \"flash_sale\",\n                                \"label\": \"فروش ویژه\",\n                                \"tone\": \"danger\",\n                                \"placement\": \"top-start\"\n                            }\n                        ],\n                        \"rating\": 4.6,\n                        \"reviewCount\": 83,\n                        \"productUrl\": \"/product/xiaomi-poco-x6-pro\"\n                    }\n                ]\n            }\n        },\n        {\n            \"id\": \"home-popular-categories\",\n            \"type\": \"category_grid\",\n            \"data\": {\n                \"title\": \"دسته‌بندی‌های محبوب\",\n                \"action\": {\n                    \"label\": \"مشاهده همه دسته‌بندی‌ها\",\n                    \"href\": \"/shop\"\n                },\n                \"variant\": \"mosaic\",\n                \"items\": [\n                    {\n                        \"id\": \"mobile\",\n                        \"title\": \"موبایل\",\n                        \"href\": \"/category/mobile\",\n                        \"media\": {\n                            \"url\": \"https://cdn.example.com/categories/mobile.webp\",\n                            \"width\": 600,\n                            \"height\": 600,\n                            \"alt\": \"گوشی موبایل\"\n                        },\n                        \"size\": \"large\"\n                    }\n                ]\n            }\n        }\n    ]\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        },
                        "url": {
                            "raw": "{{base_url}}/admin/homepage",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "admin",
                                "homepage"
                            ]
                        },
                        "description": "Atomically replaces the whole draft document. Set draft_revision to the current draft's revision (from Get Draft) before sending; If-Match and body.revision must both match it. A 409 means the draft changed since you fetched it."
                    }
                },
                {
                    "name": "Validate Document",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            }
                        ],
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"schemaVersion\": 1,\n    \"revision\": \"{{draft_revision}}\",\n    \"seo\": {\n        \"title\": \"فروشگاه اینترنتی آواتار\",\n        \"description\": \"خرید آنلاین محصولات دیجیتال با ضمانت اصالت کالا\",\n        \"canonical\": \"https://shop.example.com/\",\n        \"robots\": \"index,follow\"\n    },\n    \"sections\": [\n        {\n            \"id\": \"home-hero-main\",\n            \"type\": \"hero_slider\",\n            \"data\": {\n                \"autoplayMs\": 6000,\n                \"slides\": [\n                    {\n                        \"id\": \"hero-mobile\",\n                        \"link\": {\n                            \"label\": \"مشاهده پیشنهادهای موبایل\",\n                            \"href\": \"/category/mobile\"\n                        },\n                        \"desktopMedia\": {\n                            \"url\": \"https://cdn.example.com/home/hero/mobile-desktop.webp\",\n                            \"width\": 1600,\n                            \"height\": 500,\n                            \"alt\": \"پیشنهادهای ویژه موبایل\"\n                        },\n                        \"mobileMedia\": {\n                            \"url\": \"https://cdn.example.com/home/hero/mobile-mobile.webp\",\n                            \"width\": 900,\n                            \"height\": 900,\n                            \"alt\": \"پیشنهادهای ویژه موبایل\"\n                        }\n                    }\n                ]\n            }\n        },\n        {\n            \"id\": \"home-autumn-banner\",\n            \"type\": \"image_banner\",\n            \"data\": {\n                \"link\": {\n                    \"label\": \"مشاهده جشنواره پاییزی\",\n                    \"href\": \"/shop?campaign=autumn\"\n                },\n                \"desktopMedia\": {\n                    \"url\": \"https://cdn.example.com/home/banners/autumn-desktop.webp\",\n                    \"width\": 1600,\n                    \"height\": 340,\n                    \"alt\": \"جشنواره پاییزی\"\n                },\n                \"mobileMedia\": {\n                    \"url\": \"https://cdn.example.com/home/banners/autumn-mobile.webp\",\n                    \"width\": 900,\n                    \"height\": 520,\n                    \"alt\": \"جشنواره پاییزی\"\n                }\n            }\n        },\n        {\n            \"id\": \"home-flash-sale\",\n            \"type\": \"product_carousel\",\n            \"data\": {\n                \"title\": \"پیشنهادهای شگفت‌انگیز\",\n                \"action\": {\n                    \"label\": \"مشاهده همه\",\n                    \"href\": \"/shop?campaign=flash-sale\"\n                },\n                \"variant\": \"flash_sale\",\n                \"products\": [\n                    {\n                        \"id\": \"14919\",\n                        \"slug\": \"xiaomi-poco-x6-pro\",\n                        \"sku\": \"20420312\",\n                        \"title\": \"گوشی شیائومی Poco X6 Pro\",\n                        \"brand\": {\n                            \"id\": \"11\",\n                            \"title\": \"شیائومی\",\n                            \"slug\": \"xiaomi\"\n                        },\n                        \"image\": {\n                            \"url\": \"https://cdn.example.com/products/14919.webp\",\n                            \"width\": 800,\n                            \"height\": 800,\n                            \"alt\": \"گوشی شیائومی Poco X6 Pro\"\n                        },\n                        \"price\": 28500000,\n                        \"previousPrice\": 31000000,\n                        \"currency\": \"IRT\",\n                        \"inStock\": true,\n                        \"stockStatus\": \"in_stock\",\n                        \"badges\": [\n                            {\n                                \"key\": \"flash_sale\",\n                                \"label\": \"فروش ویژه\",\n                                \"tone\": \"danger\",\n                                \"placement\": \"top-start\"\n                            }\n                        ],\n                        \"rating\": 4.6,\n                        \"reviewCount\": 83,\n                        \"productUrl\": \"/product/xiaomi-poco-x6-pro\"\n                    }\n                ]\n            }\n        },\n        {\n            \"id\": \"home-popular-categories\",\n            \"type\": \"category_grid\",\n            \"data\": {\n                \"title\": \"دسته‌بندی‌های محبوب\",\n                \"action\": {\n                    \"label\": \"مشاهده همه دسته‌بندی‌ها\",\n                    \"href\": \"/shop\"\n                },\n                \"variant\": \"mosaic\",\n                \"items\": [\n                    {\n                        \"id\": \"mobile\",\n                        \"title\": \"موبایل\",\n                        \"href\": \"/category/mobile\",\n                        \"media\": {\n                            \"url\": \"https://cdn.example.com/categories/mobile.webp\",\n                            \"width\": 600,\n                            \"height\": 600,\n                            \"alt\": \"گوشی موبایل\"\n                        },\n                        \"size\": \"large\"\n                    }\n                ]\n            }\n        }\n    ]\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        },
                        "url": {
                            "raw": "{{base_url}}/admin/homepage/validate",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "admin",
                                "homepage",
                                "validate"
                            ]
                        },
                        "description": "Schema-only validation, does not persist anything. Returns 422 with a per-field errors array when invalid."
                    }
                },
                {
                    "name": "Publish",
                    "request": {
                        "method": "POST",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            },
                            {
                                "key": "Content-Type",
                                "value": "application/json"
                            },
                            {
                                "key": "If-Match",
                                "value": "\"{{draft_revision}}\""
                            }
                        ],
                        "body": {
                            "mode": "raw",
                            "raw": "{\n    \"revision\": \"{{draft_revision}}\"\n}",
                            "options": {
                                "raw": {
                                    "language": "json"
                                }
                            }
                        },
                        "url": {
                            "raw": "{{base_url}}/admin/homepage/publish",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "admin",
                                "homepage",
                                "publish"
                            ]
                        },
                        "description": "Publishes the current draft atomically and invalidates the storefront cache. revision must equal the draft revision you are publishing."
                    }
                }
            ]
        },
        {
            "name": "Storefront",
            "item": [
                {
                    "name": "Get Home Init (Public)",
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Accept",
                                "value": "application/json"
                            }
                        ],
                        "url": {
                            "raw": "{{base_url}}/home/init",
                            "host": [
                                "{{base_url}}"
                            ],
                            "path": [
                                "home",
                                "init"
                            ]
                        },
                        "auth": {
                            "type": "noauth"
                        },
                        "description": "Public storefront payload built from the last published document. Supports conditional GET via If-None-Match."
                    }
                }
            ]
        }
    ]
}
