{
    "openapi": "3.1.0",
    "info": {
        "title": "Backstore",
        "version": "1.0.0",
        "description": "Per-instance e-shop administration (Backstore) for the Retailys Business Platform. Converted from the archived old-backstore mock: dashboard, content (blog / banners / menus / popups / forms), design (storefront template + version history), settings (general / document-series / audit-log) and the instance onboarding flow.\n\nRegistered as an RBP sub-app (App Registry). RBP reads x-rbp-app + x-rbp-app-tree + x-rbp-navigation + x-rbp-canvas and mounts the proxy at /v2/{tenantId}/backstore/* -> {proxyBaseUrl}/*. Paths below are declared RELATIVE to proxyBaseUrl (no /v2/{tenantId}/backstore prefix — the gateway prepends it; prependSlug=true).",
        "contact": { "name": "Retailys", "url": "https://backstore.sandbox.retailys.com" }
    },
    "servers": [
        {
            "url": "https://backstore.sandbox.retailys.com",
            "description": "Sandbox origin — matches proxyBaseUrl of the registration (RBP proxies /v2/{tenantId}/backstore/* here)."
        }
    ],
    "security": [{ "oauth": [] }],
    "tags": [
        { "name": "health", "description": "Liveness & readiness probes (public, no auth)." },
        { "name": "instances", "description": "E-shop instances + onboarding." },
        { "name": "content", "description": "Blog, banners, menus, popups, forms." },
        { "name": "design", "description": "Storefront template + palette + version history." },
        { "name": "settings", "description": "General settings, document series, audit log." }
    ],
    "paths": {
        "/live": {
            "get": {
                "tags": ["health"],
                "operationId": "backstore_live",
                "summary": "Liveness probe",
                "security": [],
                "responses": {
                    "200": {
                        "description": "alive",
                        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/LiveResponse" }, "example": { "status": "alive" } } }
                    }
                }
            }
        },
        "/ready": {
            "get": {
                "tags": ["health"],
                "operationId": "backstore_ready",
                "summary": "Readiness probe",
                "security": [],
                "responses": {
                    "200": {
                        "description": "ready",
                        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ReadyResponse" }, "example": { "status": "ok" } } }
                    },
                    "503": { "description": "degraded", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ReadyResponse" } } } }
                }
            }
        },
        "/instances": {
            "get": {
                "tags": ["instances"],
                "operationId": "backstore_instances_list",
                "summary": "List e-shop instances",
                "parameters": [{ "$ref": "#/components/parameters/page" }],
                "responses": {
                    "200": {
                        "description": "Instances",
                        "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/BackstoreInstance" } } } }
                    }
                }
            },
            "post": {
                "tags": ["instances"],
                "operationId": "backstore_instances_create",
                "summary": "Create an instance (onboarding wizard)",
                "requestBody": {
                    "required": true,
                    "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BackstoreInstanceCreate" } } }
                },
                "responses": {
                    "201": { "description": "Created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BackstoreInstance" } } } }
                }
            }
        },
        "/instances/{instanceId}": {
            "parameters": [{ "$ref": "#/components/parameters/instanceId" }],
            "get": {
                "tags": ["instances"],
                "operationId": "backstore_instance_get",
                "responses": {
                    "200": { "description": "Instance", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BackstoreInstance" } } } }
                }
            },
            "patch": {
                "tags": ["instances"],
                "operationId": "backstore_instance_update",
                "requestBody": {
                    "required": true,
                    "content": { "application/merge-patch+json": { "schema": { "$ref": "#/components/schemas/BackstoreInstanceCreate" } } }
                },
                "responses": {
                    "200": { "description": "Updated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BackstoreInstance" } } } }
                }
            },
            "delete": { "tags": ["instances"], "operationId": "backstore_instance_delete", "responses": { "204": { "description": "Deleted" } } }
        },
        "/instances/{instanceId}/settings": {
            "parameters": [{ "$ref": "#/components/parameters/instanceId" }],
            "get": {
                "tags": ["settings"],
                "operationId": "backstore_settings_get",
                "responses": {
                    "200": { "description": "Settings", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/InstanceSettings" } } } }
                }
            },
            "put": {
                "tags": ["settings"],
                "operationId": "backstore_settings_update",
                "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/InstanceSettings" } } } },
                "responses": {
                    "200": { "description": "Updated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/InstanceSettings" } } } }
                }
            }
        },
        "/instances/{instanceId}/design": {
            "parameters": [{ "$ref": "#/components/parameters/instanceId" }],
            "get": {
                "tags": ["design"],
                "operationId": "backstore_design_get",
                "summary": "Storefront template + palette + identity overrides",
                "responses": {
                    "200": { "description": "Design", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/InstanceDesign" } } } }
                }
            },
            "put": {
                "tags": ["design"],
                "operationId": "backstore_design_update",
                "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/InstanceDesign" } } } },
                "responses": {
                    "200": { "description": "Updated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/InstanceDesign" } } } }
                }
            }
        },
        "/instances/{instanceId}/design/versions": {
            "parameters": [{ "$ref": "#/components/parameters/instanceId" }],
            "get": {
                "tags": ["design"],
                "operationId": "backstore_versions_list",
                "summary": "Identity-override snapshot history",
                "responses": {
                    "200": {
                        "description": "Snapshots",
                        "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/IdentitySnapshot" } } } }
                    }
                }
            },
            "post": {
                "tags": ["design"],
                "operationId": "backstore_versions_create",
                "responses": {
                    "201": { "description": "Snapshot", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/IdentitySnapshot" } } } }
                }
            }
        },
        "/instances/{instanceId}/design/versions/{versionId}": {
            "parameters": [
                { "$ref": "#/components/parameters/instanceId" },
                { "name": "versionId", "in": "path", "required": true, "schema": { "type": "string" } }
            ],
            "delete": { "tags": ["design"], "operationId": "backstore_version_delete", "responses": { "204": { "description": "Deleted" } } }
        },
        "/instances/{instanceId}/blog": {
            "parameters": [{ "$ref": "#/components/parameters/instanceId" }],
            "get": {
                "tags": ["content"],
                "operationId": "backstore_blog_list",
                "parameters": [{ "$ref": "#/components/parameters/page" }],
                "responses": {
                    "200": {
                        "description": "Articles",
                        "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/BlogArticle" } } } }
                    }
                }
            },
            "post": {
                "tags": ["content"],
                "operationId": "backstore_blog_create",
                "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BlogArticle" } } } },
                "responses": {
                    "201": { "description": "Created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BlogArticle" } } } }
                }
            }
        },
        "/instances/{instanceId}/blog/{id}": {
            "parameters": [{ "$ref": "#/components/parameters/instanceId" }, { "$ref": "#/components/parameters/id" }],
            "get": {
                "tags": ["content"],
                "operationId": "backstore_blog_get",
                "responses": {
                    "200": { "description": "Article", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BlogArticle" } } } }
                }
            },
            "patch": {
                "tags": ["content"],
                "operationId": "backstore_blog_update",
                "requestBody": {
                    "required": true,
                    "content": { "application/merge-patch+json": { "schema": { "$ref": "#/components/schemas/BlogArticle" } } }
                },
                "responses": {
                    "200": { "description": "Updated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/BlogArticle" } } } }
                }
            },
            "delete": { "tags": ["content"], "operationId": "backstore_blog_delete", "responses": { "204": { "description": "Deleted" } } }
        },
        "/instances/{instanceId}/banners": {
            "parameters": [{ "$ref": "#/components/parameters/instanceId" }],
            "get": {
                "tags": ["content"],
                "operationId": "backstore_banners_list",
                "responses": {
                    "200": {
                        "description": "Banners",
                        "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Banner" } } } }
                    }
                }
            },
            "post": {
                "tags": ["content"],
                "operationId": "backstore_banners_create",
                "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Banner" } } } },
                "responses": { "201": { "description": "Created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Banner" } } } } }
            }
        },
        "/instances/{instanceId}/banners/{id}": {
            "parameters": [{ "$ref": "#/components/parameters/instanceId" }, { "$ref": "#/components/parameters/id" }],
            "get": {
                "tags": ["content"],
                "operationId": "backstore_banner_get",
                "responses": { "200": { "description": "Banner", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Banner" } } } } }
            },
            "patch": {
                "tags": ["content"],
                "operationId": "backstore_banner_update",
                "requestBody": { "required": true, "content": { "application/merge-patch+json": { "schema": { "$ref": "#/components/schemas/Banner" } } } },
                "responses": { "200": { "description": "Updated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Banner" } } } } }
            },
            "delete": { "tags": ["content"], "operationId": "backstore_banner_delete", "responses": { "204": { "description": "Deleted" } } }
        },
        "/instances/{instanceId}/menus": {
            "parameters": [{ "$ref": "#/components/parameters/instanceId" }],
            "get": {
                "tags": ["content"],
                "operationId": "backstore_menu_get",
                "summary": "Storefront menu tree",
                "responses": {
                    "200": {
                        "description": "Menu tree",
                        "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/MenuItem" } } } }
                    }
                }
            },
            "put": {
                "tags": ["content"],
                "operationId": "backstore_menu_update",
                "requestBody": {
                    "required": true,
                    "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/MenuItem" } } } }
                },
                "responses": {
                    "200": {
                        "description": "Saved",
                        "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/MenuItem" } } } }
                    }
                }
            }
        },
        "/instances/{instanceId}/popups": {
            "parameters": [{ "$ref": "#/components/parameters/instanceId" }],
            "get": {
                "tags": ["content"],
                "operationId": "backstore_popups_list",
                "responses": {
                    "200": {
                        "description": "Popups",
                        "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Popup" } } } }
                    }
                }
            },
            "post": {
                "tags": ["content"],
                "operationId": "backstore_popups_create",
                "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Popup" } } } },
                "responses": { "201": { "description": "Created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Popup" } } } } }
            }
        },
        "/instances/{instanceId}/popups/{id}": {
            "parameters": [{ "$ref": "#/components/parameters/instanceId" }, { "$ref": "#/components/parameters/id" }],
            "patch": {
                "tags": ["content"],
                "operationId": "backstore_popup_update",
                "requestBody": { "required": true, "content": { "application/merge-patch+json": { "schema": { "$ref": "#/components/schemas/Popup" } } } },
                "responses": { "200": { "description": "Updated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Popup" } } } } }
            },
            "delete": { "tags": ["content"], "operationId": "backstore_popup_delete", "responses": { "204": { "description": "Deleted" } } }
        },
        "/instances/{instanceId}/forms": {
            "parameters": [{ "$ref": "#/components/parameters/instanceId" }],
            "get": {
                "tags": ["content"],
                "operationId": "backstore_forms_list",
                "responses": {
                    "200": {
                        "description": "Forms",
                        "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/CustomForm" } } } }
                    }
                }
            },
            "post": {
                "tags": ["content"],
                "operationId": "backstore_forms_create",
                "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomForm" } } } },
                "responses": {
                    "201": { "description": "Created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CustomForm" } } } }
                }
            }
        },
        "/instances/{instanceId}/document-series": {
            "parameters": [{ "$ref": "#/components/parameters/instanceId" }],
            "get": {
                "tags": ["settings"],
                "operationId": "backstore_docseries_list",
                "responses": {
                    "200": {
                        "description": "Document series",
                        "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/DocumentSeries" } } } }
                    }
                }
            },
            "post": {
                "tags": ["settings"],
                "operationId": "backstore_docseries_create",
                "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DocumentSeries" } } } },
                "responses": {
                    "201": { "description": "Created", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DocumentSeries" } } } }
                }
            }
        },
        "/instances/{instanceId}/document-series/{id}": {
            "parameters": [{ "$ref": "#/components/parameters/instanceId" }, { "$ref": "#/components/parameters/id" }],
            "patch": {
                "tags": ["settings"],
                "operationId": "backstore_docseries_update",
                "requestBody": {
                    "required": true,
                    "content": { "application/merge-patch+json": { "schema": { "$ref": "#/components/schemas/DocumentSeries" } } }
                },
                "responses": {
                    "200": { "description": "Updated", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/DocumentSeries" } } } }
                }
            }
        },
        "/instances/{instanceId}/audit-log": {
            "parameters": [{ "$ref": "#/components/parameters/instanceId" }],
            "get": {
                "tags": ["settings"],
                "operationId": "backstore_auditlog_list",
                "summary": "Read-only activity log",
                "parameters": [
                    { "name": "action", "in": "query", "schema": { "type": "string", "enum": ["create", "update", "delete", "login", "export"] } },
                    {
                        "name": "entity",
                        "in": "query",
                        "schema": { "type": "string", "enum": ["product", "order", "customer", "settings", "promotion", "category"] }
                    },
                    { "name": "q", "in": "query", "schema": { "type": "string" } }
                ],
                "responses": {
                    "200": {
                        "description": "Events",
                        "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/AuditEvent" } } } }
                    }
                }
            }
        }
    },
    "components": {
        "parameters": {
            "instanceId": { "name": "instanceId", "in": "path", "required": true, "schema": { "type": "string" } },
            "id": { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } },
            "page": { "name": "page", "in": "query", "schema": { "type": "integer", "minimum": 1, "default": 1 } }
        },
        "securitySchemes": {
            "oauth": {
                "type": "oauth2",
                "flows": {
                    "authorizationCode": {
                        "authorizationUrl": "https://api.sandbox.retailys.com/v2/iam/connect/authorize/",
                        "tokenUrl": "https://api.sandbox.retailys.com/v2/iam/connect/token/",
                        "scopes": {
                            "backstore:instances:read": "Read e-shop instances",
                            "backstore:instances:write": "Manage e-shop instances",
                            "backstore:content:read": "Read content (blog/banners/menus/popups/forms)",
                            "backstore:content:write": "Manage content",
                            "backstore:design:read": "Read storefront design",
                            "backstore:design:write": "Manage storefront design",
                            "backstore:settings:read": "Read instance settings",
                            "backstore:settings:write": "Manage instance settings"
                        }
                    }
                }
            }
        },
        "schemas": {
            "LiveResponse": {
                "type": "object",
                "required": ["status"],
                "properties": { "status": { "type": "string", "enum": ["alive"] } }
            },
            "ReadyResponse": {
                "type": "object",
                "required": ["status"],
                "properties": {
                    "status": { "type": "string", "enum": ["ok", "degraded"] },
                    "checks": { "type": "object", "additionalProperties": { "type": "boolean" } }
                }
            },
            "BackstoreInstance": {
                "type": "object",
                "x-rbp": {
                    "label": "E-shop",
                    "labelPlural": "E-shopy",
                    "displayField": "name",
                    "icon": "Rocket02",
                    "description": "E-shop instance provozovaná tenantem.",
                    "policies": { "read": "backstore:instances:read", "write": "backstore:instances:write", "delete": "backstore:instances:write" }
                },
                "x-rbp-admin": {
                    "datagrid": {
                        "columns": [
                            { "field": "name", "label": "Název", "isRowHeader": true, "sortable": true },
                            { "field": "url", "label": "URL", "renderer": "uri" },
                            { "field": "locale", "label": "Jazyk" },
                            { "field": "currency", "label": "Měna" },
                            { "field": "status", "label": "Stav" },
                            { "field": "selectedProductsCount", "label": "Produkty", "align": "right" },
                            { "field": "createdAt", "label": "Vytvořeno", "renderer": "date" }
                        ],
                        "defaultSort": { "field": "createdAt", "direction": "desc" }
                    }
                },
                "required": ["id", "name", "url", "locale", "currency", "status", "branding", "createdAt", "selectedProductsCount", "kpis"],
                "properties": {
                    "id": { "type": "string", "readOnly": true },
                    "name": { "type": "string", "minLength": 3 },
                    "description": { "type": "string" },
                    "url": { "type": "string", "format": "uri" },
                    "customDomain": { "type": "string" },
                    "locale": { "type": "string", "pattern": "^[a-z]{2}(-[A-Z]{2})?$" },
                    "currency": { "type": "string", "pattern": "^[A-Z]{3}$" },
                    "status": {
                        "type": "string",
                        "enum": ["active", "paused", "archived", "setup"],
                        "x-rbp-enum": {
                            "active": { "label": "Aktivní", "color": "success" },
                            "paused": { "label": "Pozastaveno", "color": "warning" },
                            "archived": { "label": "Archivováno", "color": "gray" },
                            "setup": { "label": "Nastavení", "color": "gray" }
                        }
                    },
                    "branding": { "$ref": "#/components/schemas/InstanceBranding" },
                    "templateId": { "type": "string", "enum": ["classic", "editorial", "marketplace", "boutique", "bazaar", "studio", "boutique-stack"] },
                    "paletteId": { "type": "string", "enum": ["atlantic", "terracotta", "volt", "noir", "pop"] },
                    "seo": { "$ref": "#/components/schemas/InstanceSeo" },
                    "features": { "$ref": "#/components/schemas/InstanceFeatures" },
                    "catalogScope": { "$ref": "#/components/schemas/InstanceCatalogScope" },
                    "createdAt": { "type": "string", "format": "date-time", "readOnly": true },
                    "selectedProductsCount": { "type": "integer", "minimum": 0 },
                    "kpis": { "$ref": "#/components/schemas/InstanceKpis" }
                }
            },
            "BackstoreInstanceCreate": {
                "type": "object",
                "description": "Onboarding-wizard projection of a new instance draft.",
                "x-rbp-form": {
                    "layout": "wizard",
                    "groups": [
                        { "name": "basics", "label": "Základní údaje", "fields": ["name", "slug", "description"], "order": 1 },
                        { "name": "products", "label": "Sortiment", "fields": ["catalogScope"], "order": 2 },
                        { "name": "domain", "label": "Doména", "fields": ["url", "customDomain"], "order": 3 },
                        { "name": "locale", "label": "Jazyk a měna", "fields": ["locale", "currency"], "order": 4 },
                        { "name": "design", "label": "Vzhled", "fields": ["templateId", "paletteId"], "order": 5 },
                        { "name": "settings", "label": "Nastavení", "fields": ["features"], "order": 6 },
                        { "name": "branding", "label": "Branding", "fields": ["branding"], "order": 7 },
                        { "name": "launch", "label": "Spuštění", "fields": [], "order": 8 }
                    ],
                    "fields": {
                        "slug": { "helpText": "Min. 3 znaky, jen a-z 0-9 -" },
                        "description": { "widget": "textarea", "rows": 3 }
                    }
                },
                "required": ["name", "slug", "locale", "currency", "branding"],
                "properties": {
                    "name": { "type": "string", "minLength": 3 },
                    "slug": { "type": "string", "minLength": 3, "pattern": "^[a-z0-9-]+$" },
                    "description": { "type": "string" },
                    "url": { "type": "string", "format": "uri" },
                    "customDomain": { "type": "string" },
                    "locale": { "type": "string", "pattern": "^[a-z]{2}(-[A-Z]{2})?$" },
                    "currency": { "type": "string", "pattern": "^[A-Z]{3}$" },
                    "templateId": { "type": "string", "enum": ["classic", "editorial", "marketplace", "boutique", "bazaar", "studio", "boutique-stack"] },
                    "paletteId": { "type": "string", "enum": ["atlantic", "terracotta", "volt", "noir", "pop"] },
                    "branding": { "$ref": "#/components/schemas/InstanceBranding" },
                    "features": { "$ref": "#/components/schemas/InstanceFeatures" },
                    "catalogScope": { "$ref": "#/components/schemas/InstanceCatalogScope" }
                }
            },
            "InstanceBranding": {
                "type": "object",
                "required": ["primary", "secondary", "accent"],
                "properties": {
                    "primary": { "type": "string", "pattern": "^#[0-9a-fA-F]{6}$" },
                    "secondary": { "type": "string", "pattern": "^#[0-9a-fA-F]{6}$" },
                    "accent": { "type": "string", "pattern": "^#[0-9a-fA-F]{6}$" },
                    "logo": { "type": "string" },
                    "favicon": { "type": "string" }
                }
            },
            "InstanceSeo": {
                "type": "object",
                "properties": {
                    "title": { "type": "string" },
                    "description": { "type": "string" },
                    "ogImage": { "type": "string" },
                    "robots": { "type": "string", "enum": ["index", "noindex"] }
                }
            },
            "InstanceFeatures": {
                "type": "object",
                "properties": {
                    "cart": { "type": "boolean" },
                    "wishlist": { "type": "boolean" },
                    "compare": { "type": "boolean" },
                    "reviews": { "type": "boolean" }
                }
            },
            "InstanceCatalogScope": {
                "type": "object",
                "properties": {
                    "categoryIds": { "type": "array", "items": { "type": "string" } },
                    "productIds": { "type": "array", "items": { "type": "string" } },
                    "channelId": { "type": "string" },
                    "priceListId": { "type": "string" }
                }
            },
            "InstanceKpis": {
                "type": "object",
                "properties": {
                    "ordersToday": { "type": "integer" },
                    "revenueMonth": { "type": "number" },
                    "conversionRate": { "type": "number" }
                }
            },
            "InstanceSettings": {
                "type": "object",
                "x-rbp": {
                    "label": "Nastavení obchodu",
                    "displayField": "name",
                    "icon": "Settings01",
                    "description": "Základní profil e-shopu.",
                    "policies": { "read": "backstore:settings:read", "write": "backstore:settings:write" }
                },
                "x-rbp-form": {
                    "layout": "single",
                    "groups": [
                        {
                            "name": "profile",
                            "label": "Profil obchodu",
                            "fields": ["name", "email", "phone", "street", "city", "zip", "country", "currency", "timezone"]
                        }
                    ],
                    "fields": {}
                },
                "properties": {
                    "name": { "type": "string" },
                    "email": { "type": "string", "format": "email" },
                    "phone": { "type": "string" },
                    "street": { "type": "string" },
                    "city": { "type": "string" },
                    "zip": { "type": "string" },
                    "country": { "type": "string" },
                    "currency": { "type": "string" },
                    "timezone": { "type": "string" }
                }
            },
            "InstanceDesign": {
                "type": "object",
                "description": "Storefront template + palette + tier-3 identity-token overrides (46 tokens). Identity overrides are CSS-string values (e.g. radiusCard: '1rem'); universalRadiusSweep is boolean.",
                "properties": {
                    "templateId": { "type": "string", "enum": ["classic", "editorial", "marketplace", "boutique", "bazaar", "studio", "boutique-stack"] },
                    "paletteId": { "type": "string", "enum": ["atlantic", "terracotta", "volt", "noir", "pop"] },
                    "identityOverrides": { "type": "object", "additionalProperties": { "type": ["string", "boolean"] } }
                }
            },
            "IdentitySnapshot": {
                "type": "object",
                "x-rbp": { "label": "Verze vzhledu", "displayField": "id", "icon": "Palette", "description": "Záloha identity-override tokenů." },
                "required": ["id", "version", "createdAt", "trigger", "overrides"],
                "properties": {
                    "id": { "type": "string" },
                    "version": { "type": "integer" },
                    "createdAt": { "type": "string", "format": "date-time" },
                    "label": { "type": "string" },
                    "trigger": { "type": "string", "enum": ["manual", "auto", "pre-restore"] },
                    "overrides": { "type": "object", "additionalProperties": { "type": ["string", "boolean"] } },
                    "templateId": { "type": "string" },
                    "paletteId": { "type": "string" },
                    "author": { "type": "string" }
                }
            },
            "BlogArticle": {
                "type": "object",
                "x-rbp": {
                    "label": "Článek",
                    "labelPlural": "Blog",
                    "displayField": "title",
                    "icon": "File06",
                    "description": "Blogový článek e-shopu.",
                    "policies": { "read": "backstore:content:read", "write": "backstore:content:write", "delete": "backstore:content:write" }
                },
                "x-rbp-admin": {
                    "datagrid": {
                        "columns": [
                            { "field": "image", "label": "Obrázek", "renderer": "image" },
                            { "field": "title", "label": "Název", "isRowHeader": true, "sortable": true },
                            { "field": "categoryName", "label": "Kategorie", "renderer": "badge" },
                            { "field": "author", "label": "Autor" },
                            { "field": "status", "label": "Stav" },
                            { "field": "publishedAt", "label": "Datum", "renderer": "date", "sortable": true }
                        ],
                        "defaultSort": { "field": "publishedAt", "direction": "desc" },
                        "filters": {
                            "status": { "type": "select", "label": "Stav" },
                            "title": { "type": "text", "label": "Hledat" }
                        }
                    },
                    "form": {
                        "layout": "single",
                        "groups": [
                            { "name": "content", "label": "Obsah", "fields": ["title", "slug", "excerpt", "content"], "order": 1 },
                            { "name": "meta", "label": "Publikace", "fields": ["status", "categoryName", "author", "publishedAt", "tags", "image"], "order": 2 }
                        ],
                        "fields": {
                            "excerpt": { "widget": "textarea", "rows": 3 },
                            "content": { "widget": "textarea", "rows": 12 },
                            "image": { "widget": "image" }
                        }
                    }
                },
                "required": ["id", "title", "slug", "status"],
                "properties": {
                    "id": { "type": "string", "readOnly": true },
                    "title": { "type": "string" },
                    "slug": { "type": "string" },
                    "excerpt": { "type": "string" },
                    "content": { "type": "string" },
                    "author": { "type": "string" },
                    "authorAvatar": { "type": "string" },
                    "categoryId": { "type": "string" },
                    "categoryName": { "type": "string" },
                    "image": { "type": "string" },
                    "publishedAt": { "type": "string", "format": "date-time" },
                    "readTime": { "type": "integer" },
                    "tags": { "type": "array", "items": { "type": "string" } },
                    "status": {
                        "type": "string",
                        "enum": ["published", "draft"],
                        "x-rbp-enum": {
                            "published": { "label": "Publikováno", "color": "success" },
                            "draft": { "label": "Koncept", "color": "gray" }
                        }
                    }
                }
            },
            "Banner": {
                "type": "object",
                "x-rbp": {
                    "label": "Banner",
                    "labelPlural": "Bannery",
                    "displayField": "title",
                    "icon": "Image01",
                    "description": "Reklamní banner storefrontu.",
                    "policies": { "read": "backstore:content:read", "write": "backstore:content:write", "delete": "backstore:content:write" }
                },
                "x-rbp-admin": {
                    "datagrid": {
                        "columns": [
                            { "field": "image", "label": "Média", "renderer": "image" },
                            { "field": "title", "label": "Název", "isRowHeader": true },
                            { "field": "position", "label": "Pozice" },
                            { "field": "status", "label": "Stav" },
                            { "field": "clicks", "label": "Kliknutí", "align": "right", "sortable": true },
                            { "field": "startDate", "label": "Od", "renderer": "date" },
                            { "field": "endDate", "label": "Do", "renderer": "date" }
                        ],
                        "filters": { "status": { "type": "select" }, "position": { "type": "select" } }
                    },
                    "form": {
                        "layout": "single",
                        "groups": [{ "name": "main", "label": "Banner", "fields": ["title", "image", "position", "status", "startDate", "endDate"] }],
                        "fields": { "image": { "widget": "image" } }
                    }
                },
                "required": ["id", "title", "position", "status"],
                "properties": {
                    "id": { "type": "string", "readOnly": true },
                    "title": { "type": "string" },
                    "image": { "type": "string" },
                    "position": {
                        "type": "string",
                        "enum": ["homepage", "category", "sidebar"],
                        "x-rbp-enum": {
                            "homepage": { "label": "Domovská", "color": "brand" },
                            "category": { "label": "Kategorie", "color": "sky" },
                            "sidebar": { "label": "Postranní", "color": "orange" }
                        }
                    },
                    "status": {
                        "type": "string",
                        "enum": ["active", "inactive"],
                        "x-rbp-enum": { "active": { "label": "Aktivní", "color": "success" }, "inactive": { "label": "Neaktivní", "color": "gray" } }
                    },
                    "clicks": { "type": "integer" },
                    "startDate": { "type": "string", "format": "date" },
                    "endDate": { "type": "string", "format": "date" }
                }
            },
            "MenuItem": {
                "type": "object",
                "x-rbp": {
                    "label": "Položka menu",
                    "labelPlural": "Menu",
                    "displayField": "label",
                    "icon": "Menu01",
                    "description": "Položka navigačního menu storefrontu (rekurzivní strom).",
                    "policies": { "read": "backstore:content:read", "write": "backstore:content:write" }
                },
                "required": ["id", "label", "url"],
                "properties": {
                    "id": { "type": "string" },
                    "label": { "type": "string" },
                    "url": { "type": "string" },
                    "newTab": { "type": "boolean", "default": false },
                    "visible": { "type": "boolean", "default": true },
                    "highlighted": { "type": "boolean", "default": false },
                    "itemType": { "type": "string", "enum": ["page", "category", "customUrl", "blog"] },
                    "children": { "type": "array", "items": { "$ref": "#/components/schemas/MenuItem" } }
                }
            },
            "Popup": {
                "type": "object",
                "x-rbp": {
                    "label": "Pop-up",
                    "labelPlural": "Pop-upy",
                    "displayField": "name",
                    "icon": "MessageSmileSquare",
                    "description": "Storefront pop-up (exit-intent, časovaný, …).",
                    "policies": { "read": "backstore:content:read", "write": "backstore:content:write", "delete": "backstore:content:write" }
                },
                "x-rbp-admin": {
                    "datagrid": {
                        "columns": [
                            { "field": "name", "label": "Název", "isRowHeader": true },
                            { "field": "type", "label": "Typ" },
                            { "field": "views", "label": "Zobrazení", "align": "right" },
                            { "field": "conversions", "label": "Konverze", "align": "right" },
                            { "field": "active", "label": "Aktivní", "renderer": "boolean" }
                        ]
                    }
                },
                "required": ["id", "name", "type"],
                "properties": {
                    "id": { "type": "string" },
                    "name": { "type": "string" },
                    "type": {
                        "type": "string",
                        "enum": ["exit_intent", "timed", "scroll", "welcome", "custom"],
                        "x-rbp-enum": {
                            "exit_intent": { "label": "Exit intent", "color": "orange" },
                            "timed": { "label": "Časovaný", "color": "sky" },
                            "scroll": { "label": "Scroll", "color": "indigo" },
                            "welcome": { "label": "Uvítací", "color": "success" },
                            "custom": { "label": "Vlastní", "color": "purple" }
                        }
                    },
                    "triggerDesc": { "type": "string" },
                    "views": { "type": "integer" },
                    "conversions": { "type": "integer" },
                    "active": { "type": "boolean", "default": true }
                }
            },
            "CustomForm": {
                "type": "object",
                "x-rbp": {
                    "label": "Formulář",
                    "labelPlural": "Formuláře",
                    "displayField": "name",
                    "icon": "Cursor04",
                    "description": "Vlastní storefront formulář.",
                    "policies": { "read": "backstore:content:read", "write": "backstore:content:write", "delete": "backstore:content:write" }
                },
                "x-rbp-admin": {
                    "datagrid": {
                        "columns": [
                            { "field": "name", "label": "Název", "isRowHeader": true },
                            { "field": "submissions", "label": "Odeslání", "align": "right" },
                            { "field": "status", "label": "Stav" },
                            { "field": "createdAt", "label": "Vytvořeno", "renderer": "date" },
                            { "field": "embedCode", "label": "Embed" }
                        ]
                    }
                },
                "required": ["id", "name", "status", "fields"],
                "properties": {
                    "id": { "type": "string" },
                    "name": { "type": "string" },
                    "fields": { "type": "array", "items": { "$ref": "#/components/schemas/FormField" } },
                    "submissions": { "type": "integer" },
                    "status": {
                        "type": "string",
                        "enum": ["active", "draft"],
                        "x-rbp-enum": { "active": { "label": "Aktivní", "color": "success" }, "draft": { "label": "Koncept", "color": "gray" } }
                    },
                    "createdAt": { "type": "string", "format": "date" },
                    "embedCode": { "type": "string" }
                }
            },
            "FormField": {
                "type": "object",
                "required": ["name", "type", "required"],
                "properties": {
                    "name": { "type": "string" },
                    "type": {
                        "type": "string",
                        "enum": ["text", "email", "select", "textarea", "checkbox", "radio", "file"],
                        "x-rbp-enum": {
                            "text": { "label": "Text", "color": "gray" },
                            "email": { "label": "E-mail", "color": "blue" },
                            "select": { "label": "Výběr", "color": "brand" },
                            "textarea": { "label": "Text. oblast", "color": "purple" },
                            "checkbox": { "label": "Zaškrtávátko", "color": "success" },
                            "radio": { "label": "Přepínač", "color": "orange" },
                            "file": { "label": "Soubor", "color": "pink" }
                        }
                    },
                    "required": { "type": "boolean" }
                }
            },
            "DocumentSeries": {
                "type": "object",
                "x-rbp": {
                    "label": "Číselná řada",
                    "labelPlural": "Číselné řady",
                    "displayField": "prefix",
                    "icon": "File06",
                    "description": "Číslování účetních dokladů.",
                    "policies": { "read": "backstore:settings:read", "write": "backstore:settings:write" }
                },
                "x-rbp-admin": {
                    "datagrid": {
                        "columns": [
                            { "field": "typeKey", "label": "Typ" },
                            { "field": "prefix", "label": "Prefix" },
                            { "field": "currentNumber", "label": "Aktuální číslo", "align": "right" },
                            { "field": "yearReset", "label": "Reset ročně", "renderer": "boolean" }
                        ]
                    }
                },
                "required": ["id", "typeKey", "prefix", "currentNumber"],
                "properties": {
                    "id": { "type": "string" },
                    "typeKey": {
                        "type": "string",
                        "enum": ["invoice", "creditNote", "deliveryNote", "proformaInvoice", "receipt"],
                        "x-rbp-enum": {
                            "invoice": { "label": "Faktura", "color": "brand" },
                            "creditNote": { "label": "Dobropis", "color": "orange" },
                            "deliveryNote": { "label": "Dodací list", "color": "sky" },
                            "proformaInvoice": { "label": "Zálohová faktura", "color": "purple" },
                            "receipt": { "label": "Účtenka", "color": "success" }
                        }
                    },
                    "prefix": { "type": "string" },
                    "currentNumber": { "type": "integer" },
                    "yearReset": { "type": "boolean", "default": true }
                }
            },
            "AuditEvent": {
                "type": "object",
                "x-rbp": {
                    "label": "Událost",
                    "labelPlural": "Audit log",
                    "displayField": "details",
                    "icon": "ClipboardCheck",
                    "description": "Záznam aktivity administrátora (read-only).",
                    "policies": { "read": "backstore:settings:read" }
                },
                "x-rbp-admin": {
                    "datagrid": {
                        "columns": [
                            { "field": "timestamp", "label": "Čas", "renderer": "date", "sortable": true },
                            { "field": "user", "label": "Uživatel" },
                            { "field": "action", "label": "Akce" },
                            { "field": "entity", "label": "Entita" },
                            { "field": "details", "label": "Popis" },
                            { "field": "ip", "label": "IP adresa" }
                        ],
                        "defaultSort": { "field": "timestamp", "direction": "desc" },
                        "filters": {
                            "action": { "type": "select" },
                            "entity": { "type": "select" },
                            "details": { "type": "text" }
                        }
                    }
                },
                "required": ["id", "timestamp", "user", "action", "entity"],
                "properties": {
                    "id": { "type": "string" },
                    "timestamp": { "type": "string", "format": "date-time" },
                    "user": { "$ref": "#/components/schemas/AuditUser" },
                    "action": {
                        "type": "string",
                        "enum": ["create", "update", "delete", "login", "export"],
                        "x-rbp-enum": {
                            "create": { "label": "Vytvoření", "color": "success" },
                            "update": { "label": "Úprava", "color": "brand" },
                            "delete": { "label": "Smazání", "color": "error" },
                            "login": { "label": "Přihlášení", "color": "gray" },
                            "export": { "label": "Export", "color": "blue" }
                        }
                    },
                    "entity": {
                        "type": "string",
                        "enum": ["product", "order", "customer", "settings", "promotion", "category"],
                        "x-rbp-enum": {
                            "product": { "label": "Produkt", "color": "gray" },
                            "order": { "label": "Objednávka", "color": "gray" },
                            "customer": { "label": "Zákazník", "color": "gray" },
                            "settings": { "label": "Nastavení", "color": "gray" },
                            "promotion": { "label": "Promo akce", "color": "gray" },
                            "category": { "label": "Kategorie", "color": "gray" }
                        }
                    },
                    "details": { "type": "string" },
                    "ip": { "type": "string" }
                }
            },
            "AuditUser": {
                "type": "object",
                "properties": {
                    "name": { "type": "string" },
                    "avatar": { "type": ["string", "null"] },
                    "initials": { "type": "string" }
                }
            }
        }
    },
    "x-rbp-app": {
        "apps": {
            "backstore": {
                "name": "Backstore",
                "type": "admin",
                "treeNodeId": "backstore",
                "description": "Správa jednotlivých e-shop instancí tenanta — obsah, vzhled, nastavení.",
                "theme": {
                    "palette": {
                        "primary": "#7C33E1",
                        "deep": "#5B21B6",
                        "secondary": "#C41273",
                        "highlight": "#FDD91F",
                        "accent": "#14B8A6"
                    },
                    "logo": { "text": "Backstore", "maxHeight": "36px" }
                }
            }
        }
    },
    "x-rbp-app-tree": {
        "version": "1.0",
        "nodes": {
            "backstore": {
                "level": 1,
                "appId": "backstore",
                "name": "Backstore",
                "description": "Per-instance e-shop administration",
                "url": "https://backstore.sandbox.retailys.com",
                "icon": "Rocket02",
                "children": ["backstore.overview", "backstore.content", "backstore.design", "backstore.settings"]
            },
            "backstore.overview": {
                "level": 2,
                "name": "Přehled",
                "icon": "Home01",
                "resources": ["instances", "dashboard"]
            },
            "backstore.content": {
                "level": 2,
                "name": "Obsah",
                "icon": "File06",
                "resources": ["blog", "banners", "menus", "popups", "forms"]
            },
            "backstore.design": {
                "level": 2,
                "name": "Vzhled",
                "icon": "Brush01",
                "resources": ["storefront-templates", "template-versions"]
            },
            "backstore.settings": {
                "level": 2,
                "name": "Nastavení",
                "icon": "Settings01",
                "resources": ["settings", "document-series", "audit-log"]
            }
        }
    },
    "x-rbp-navigation": {
        "backstore": {
            "menu": [
                { "category": "overview", "services": ["dashboard"] },
                { "category": "content", "services": ["blog", "banners", "menus", "popups", "forms"] },
                { "category": "design", "services": ["storefront-templates", "template-versions"] },
                { "category": "settings", "services": ["settings", "document-series", "audit-log"] }
            ],
            "categories": {
                "overview": ["dashboard"],
                "content": ["blog", "banners", "menus", "popups", "forms"],
                "design": ["storefront-templates", "template-versions"],
                "settings": ["settings", "document-series", "audit-log"]
            }
        }
    },
    "x-rbp-canvas": {
        "version": "1.0",
        "canvases": {
            "backstore-dashboard": {
                "title": "Dashboard",
                "description": "Přehled výkonu e-shop instance.",
                "icon": "Home01",
                "route": "dashboard",
                "appId": "backstore",
                "grid": { "columns": 12, "gap": "md" },
                "context": { "timeRange": { "enabled": true, "default": "30d", "presets": ["7d", "30d", "90d"] } },
                "widgets": [
                    {
                        "id": "stat-revenue",
                        "type": "stat",
                        "title": "Dnešní tržby",
                        "layout": { "colSpan": 3 },
                        "data": { "kind": "aggregate", "resource": "oms/{tenantId}/orders", "measures": [{ "id": "revenue", "op": "sum", "field": "total" }] },
                        "options": { "format": "currency", "changeVs": "yesterday", "icon": "CoinsStacked01" }
                    },
                    {
                        "id": "stat-orders",
                        "type": "stat",
                        "title": "Dnešní objednávky",
                        "layout": { "colSpan": 3 },
                        "data": { "kind": "aggregate", "resource": "oms/{tenantId}/orders", "measures": [{ "id": "count", "op": "count" }] },
                        "options": { "changeVs": "yesterday", "icon": "ShoppingCart01" }
                    },
                    {
                        "id": "stat-conversion",
                        "type": "stat",
                        "title": "Konverzní poměr",
                        "layout": { "colSpan": 3 },
                        "data": { "kind": "static", "value": 3.8 },
                        "options": { "format": "percent", "decimals": 1, "icon": "Target04" }
                    },
                    {
                        "id": "stat-customers",
                        "type": "stat",
                        "title": "Aktivní zákazníci",
                        "layout": { "colSpan": 3 },
                        "data": { "kind": "aggregate", "resource": "crm/{tenantId}/customers", "measures": [{ "id": "count", "op": "count" }] },
                        "options": { "changeVs": "yesterday", "icon": "Users01" }
                    },
                    {
                        "id": "chart-revenue",
                        "type": "chart",
                        "title": "Tržby (30 dní)",
                        "layout": { "colSpan": 12, "minHeight": 260 },
                        "data": {
                            "kind": "aggregate",
                            "resource": "oms/{tenantId}/orders",
                            "groupBy": { "field": "createdAt", "interval": "day" },
                            "measures": [{ "id": "revenue", "op": "sum", "field": "total" }]
                        },
                        "options": { "chartType": "bar", "xField": "key", "yField": "revenue", "format": "currency" }
                    },
                    {
                        "id": "chart-orders",
                        "type": "chart",
                        "title": "Objednávky (30 dní)",
                        "layout": { "colSpan": 5, "minHeight": 240 },
                        "data": {
                            "kind": "aggregate",
                            "resource": "oms/{tenantId}/orders",
                            "groupBy": { "field": "createdAt", "interval": "day" },
                            "measures": [{ "id": "count", "op": "count" }]
                        },
                        "options": { "chartType": "bar", "xField": "key", "yField": "count" }
                    },
                    {
                        "id": "table-recent-orders",
                        "type": "table",
                        "title": "Poslední objednávky",
                        "layout": { "colSpan": 7 },
                        "data": {
                            "kind": "collection",
                            "resource": "oms/{tenantId}/orders",
                            "orderBy": { "field": "createdAt", "direction": "desc" },
                            "limit": 6
                        },
                        "options": { "columns": ["orderNumber", "customer", "total", "status"] }
                    },
                    {
                        "id": "list-top-products",
                        "type": "list",
                        "title": "Nejprodávanější",
                        "layout": { "colSpan": 4 },
                        "data": { "kind": "collection", "resource": "pim/{tenantId}/products", "limit": 5 },
                        "options": { "primaryField": "name", "secondaryField": "sku", "imageField": "image" }
                    },
                    {
                        "id": "list-low-stock",
                        "type": "list",
                        "title": "Nízké zásoby",
                        "layout": { "colSpan": 4 },
                        "data": {
                            "kind": "collection",
                            "resource": "wms/{tenantId}/stock-items",
                            "clientFilter": [{ "field": "available", "op": "lte", "value": 10 }],
                            "orderBy": { "field": "available", "direction": "asc" },
                            "limit": 5
                        },
                        "options": { "primaryField": "name", "secondaryField": "sku", "badgeField": "available" }
                    },
                    {
                        "id": "actions-pending",
                        "type": "actions",
                        "title": "Čekající akce",
                        "layout": { "colSpan": 4 },
                        "data": { "kind": "static", "value": null },
                        "options": {
                            "actions": [
                                { "label": "Objednávky k odeslání", "route": "orders", "icon": "Package" },
                                { "label": "Vrácení ke zpracování", "route": "orders/returns", "icon": "RefreshCcw01" },
                                { "label": "Platby k potvrzení", "route": "payments", "icon": "CreditCard01" },
                                { "label": "Produkty k recenzi", "route": "products/reviews", "icon": "Star01" }
                            ]
                        }
                    }
                ]
            }
        }
    }
}
